Method: MIME::Type#like?

Defined in:
lib/mime/type.rb

#like?(other) ⇒ Boolean

Indicates that a MIME type is like another type. This differs from == because x- prefixes are removed for this comparison.

Returns:

  • (Boolean)


174
175
176
177
178
179
180
181
182
# File 'lib/mime/type.rb', line 174

def like?(other)
  other =
    if other.respond_to?(:simplified)
      MIME::Type.simplified(other.simplified, remove_x_prefix: true)
    else
      MIME::Type.simplified(other.to_s, remove_x_prefix: true)
    end
  MIME::Type.simplified(simplified, remove_x_prefix: true) == other
end