Method: Mime::Type.register
- Defined in:
- lib/dependency/mime_type.rb
.register(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false) ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'lib/dependency/mime_type.rb', line 102 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 { |str| LOOKUP[str] = SET.last } unless skip_lookup ([symbol.to_s] + extension_synonyms).each { |ext| EXTENSION_LOOKUP[ext] = SET.last } end |