instance method
==
Ruby on Rails edge
Signature
==(mime_type)
No documentation comment.
Parameters
-
mime_typereq
Source
# File actionpack/lib/action_dispatch/http/mime_type.rb, line 386
def ==(mime_type)
return false unless mime_type
if mime_type.is_a?(Symbol)
# `format == :json` is the common call. Compare the symbol directly, and
# use `Symbol#name` so that the string comparison doesn't allocate.
return true if @symbol == mime_type
mime_string = mime_type.name
else
mime_string = mime_type.to_s
end
return true if @string == mime_string || @synonyms.include?(mime_string)
mime_symbol = mime_type.to_sym
@symbol == mime_symbol || @synonyms.any? { |synonym| synonym.to_sym == mime_symbol }
end
Defined in actionpack/lib/action_dispatch/http/mime_type.rb line 386
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Mime::Type