Module: Mime
| Relationships & Source Files | |
| Namespace Children | |
|
Classes:
| |
| Defined in: | actionpack/lib/action_dispatch/http/mime_type.rb |
Constant Summary
-
ALL =
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 447
ALLisn't a real MIME type, so we don't register it for lookup with the other concrete types. It's a wildcard match that we use forrespond_tonegotiation internals.AllType.instance
-
EXTENSION_LOOKUP =
Internal use only
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 75ActiveSupport::Deprecation::DeprecatedObjectProxy.new( # :nodoc: @lookup_by_extension, "Mime::EXTENSION_LOOKUP is deprecated. Use Mime.extensions to enumerate registered extensions, or Mime::Type.lookup_by_extension / Mime[...] to look one up.", ActionDispatch.deprecator, )
-
LOOKUP =
Internal use only
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 70ActiveSupport::Deprecation::DeprecatedObjectProxy.new( # :nodoc: @lookup_by_string, "Mime::LOOKUP is deprecated. Use Mime::Type.lookup instead.", ActionDispatch.deprecator, )
-
SET =
Internal use only
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 65ActiveSupport::Deprecation::DeprecatedObjectProxy.new( # :nodoc: @registry, "Mime::SET is deprecated. Use Mime.symbols to enumerate registered types, or Mime[...] / Mime::Type.lookup to look one up.", ActionDispatch.deprecator, )
Class Attribute Summary
- .lookup_by_extension readonly Internal use only
- .lookup_by_string readonly Internal use only
- .registry readonly Internal use only
Class Method Summary
- .[](type)
- .extensions
- .fetch(type, &block)
- .symbols
- .eager_load! Internal use only
- .update Internal use only
- .valid_symbols?(symbols) ⇒ Boolean Internal use only
Class Attribute Details
.lookup_by_extension (readonly)
This method is for internal use only.
[ GitHub ]
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 82
attr_reader :registry, :lookup_by_string, :lookup_by_extension # :nodoc:
.lookup_by_string (readonly)
This method is for internal use only.
[ GitHub ]
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 82
attr_reader :registry, :lookup_by_string, :lookup_by_extension # :nodoc:
.registry (readonly)
This method is for internal use only.
[ GitHub ]
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 82
attr_reader :registry, :lookup_by_string, :lookup_by_extension # :nodoc:
Class Method Details
.[](type)
[ GitHub ]# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 84
def [](type) return type if type.is_a?(Type) Type.lookup_by_extension(type) end
.eager_load!
This method is for internal use only.
[ GitHub ]
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 106
def eager_load! # :nodoc: @registry.freeze @lookup_by_string.freeze @lookup_by_extension.freeze nil end
.extensions
[ GitHub ]# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 93
def extensions @lookup_by_extension.keys end
.fetch(type, &block)
[ GitHub ]# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 101
def fetch(type, &block) return type if type.is_a?(Type) @lookup_by_extension.fetch(type.to_s, &block) end
.symbols
[ GitHub ]# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 89
def symbols @registry.symbols end
.update
This method is for internal use only.
[ GitHub ]
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 113
def update # :nodoc: if @registry.frozen? ActionDispatch.deprecator.warn(<<~DEPRECATION.squish) Registering or unregistering a MIME type after the application has been initialized is deprecated. Register custom MIME types from an initializer instead (e.g. config/initializers/mime_types.rb). This will raise a FrozenError in Rails 9.0. DEPRECATION registry, string_lookup, extension_lookup = @registry.dup, @lookup_by_string.dup, @lookup_by_extension.dup yield registry, string_lookup, extension_lookup @registry = registry.freeze @lookup_by_string = string_lookup.freeze @lookup_by_extension = extension_lookup.freeze SET.target = @registry LOOKUP.target = @lookup_by_string EXTENSION_LOOKUP.target = @lookup_by_extension else yield @registry, @lookup_by_string, @lookup_by_extension end end
.valid_symbols?(symbols) ⇒ Boolean
This method is for internal use only.