class method
self.new
Ruby on Rails edge
Signature
self.new(string, symbol = nil, synonyms = nil)
No documentation comment.
Parameters
-
stringreq -
symbolopt = nil -
synonymsopt = nil
Source
# File actionpack/lib/action_dispatch/http/mime_type.rb, line 342
def initialize(string, symbol = nil, synonyms = nil)
unless MIME_REGEXP.match?(string)
raise InvalidMimeType, "#{string.inspect} is not a valid MIME type"
end
@symbol = symbol
@synonyms = if synonyms&.any?
synonyms.map { |synonym| synonym.dup.freeze }.freeze
else
[].freeze
end
@string = string.dup.freeze
@hash = [@string, @synonyms, @symbol].hash
freeze
end
Defined in actionpack/lib/action_dispatch/http/mime_type.rb line 342
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Mime::Type