Returns the correct encoding for a given mime type, while falling back on the default external encoding, if it exists.
# File lib/sprockets/mime.rb, line 37 37: def encoding_for_mime_type(type) 38: encoding = Encoding::BINARY if type =~ %{^(image|audio|video)/} 39: encoding ||= default_external_encoding if respond_to?(:default_external_encoding) 40: encoding 41: end
# File lib/sprockets/mime.rb, line 19 19: def extension_for_mime_type(type) 20: mime_types.key(type) 21: end
# File lib/sprockets/mime.rb, line 23 23: def extension_for_mime_type(type) 24: mime_types.index(type) 25: end
Returns a `Hash` of registered mime types registered on the environment and those part of `Rack::Mime`.
If an `ext` is given, it will lookup the mime type for that extension.
# File lib/sprockets/mime.rb, line 9 9: def mime_types(ext = nil) 10: if ext.nil? 11: Rack::Mime::MIME_TYPES.merge(@mime_types) 12: else 13: ext = Sprockets::Utils.normalize_extension(ext) 14: @mime_types[ext] || Rack::Mime::MIME_TYPES[ext] 15: end 16: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.