diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/http/mime_type.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/http/mime_type.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index 4672ea7199..3e6cfeb3d0 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -1,8 +1,8 @@ # -*- frozen-string-literal: true -*- -require 'singleton' -require 'active_support/core_ext/module/attribute_accessors' -require 'active_support/core_ext/string/starts_ends_with' +require "singleton" +require "active_support/core_ext/module/attribute_accessors" +require "active_support/core_ext/string/starts_ends_with" module Mime class Mimes @@ -99,7 +99,7 @@ module Mime def initialize(index, name, q = nil) @index = index @name = name - q ||= 0.0 if @name == '*/*'.freeze # default wildcard match to end of list + q ||= 0.0 if @name == "*/*".freeze # default wildcard match to end of list @q = ((q || 1.0).to_f * 100).to_i end @@ -114,7 +114,7 @@ module Mime def self.sort!(list) list.sort! - text_xml_idx = find_item_by_name list, 'text/xml' + text_xml_idx = find_item_by_name list, "text/xml" app_xml_idx = find_item_by_name list, Mime[:xml].to_s # Take care of the broken text/xml entry by renaming or deleting it @@ -141,7 +141,7 @@ module Mime type = list[idx] break if type.q < app_xml.q - if type.name.ends_with? '+xml' + if type.name.ends_with? "+xml" list[app_xml_idx], list[idx] = list[idx], app_xml app_xml_idx = idx end @@ -195,12 +195,12 @@ module Mime end def parse(accept_header) - if !accept_header.include?(',') + if !accept_header.include?(",") accept_header = accept_header.split(PARAMETER_SEPARATOR_REGEXP).first parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact else list, index = [], 0 - accept_header.split(',').each do |header| + accept_header.split(",").each do |header| params, q = header.split(PARAMETER_SEPARATOR_REGEXP) next unless params @@ -314,7 +314,7 @@ module Mime def to_a; end def method_missing(method, *args) - if method.to_s.ends_with? '?' + if method.to_s.ends_with? "?" method[0..-2].downcase.to_sym == to_sym else super @@ -322,7 +322,7 @@ module Mime end def respond_to_missing?(method, include_private = false) #:nodoc: - method.to_s.ends_with? '?' + method.to_s.ends_with? "?" end end @@ -330,7 +330,7 @@ module Mime include Singleton def initialize - super '*/*', :all + super "*/*", :all end def all?; true; end @@ -352,14 +352,14 @@ module Mime def ref; end def respond_to_missing?(method, include_private = false) - method.to_s.ends_with? '?' + method.to_s.ends_with? "?" end private def method_missing(method, *args) - false if method.to_s.ends_with? '?' + false if method.to_s.ends_with? "?" end end end -require 'action_dispatch/http/mime_types' +require "action_dispatch/http/mime_types" |