Method: Mime::Type.register

Defined in:
lib/action_controller/mime_type.rb

.register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/action_controller/mime_type.rb', line 79

def register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)
  Mime.instance_eval { const_set symbol.to_s.upcase, Type.new(string, symbol, mime_type_synonyms) }

  SET << Mime.const_get(symbol.to_s.upcase)

  ([string] + mime_type_synonyms).each { |string| LOOKUP[string] = SET.last } unless skip_lookup
  ([symbol.to_s] + extension_synonyms).each { |ext| EXTENSION_LOOKUP[ext] = SET.last }
end