Class: Utility::ExtensionMappingUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/utility/extension_mapping_util.rb

Class Method Summary collapse

Class Method Details

.get_extension(mime_type) ⇒ Object



115
116
117
# File 'lib/utility/extension_mapping_util.rb', line 115

def self.get_extension(mime_type)
  mime_to_extension[mime_type.to_s.downcase]
end

.get_mime_types(extension) ⇒ Object



119
120
121
# File 'lib/utility/extension_mapping_util.rb', line 119

def self.get_mime_types(extension)
  @extension_to_mime[extension.to_s.downcase]
end

.mime_to_extensionObject



109
110
111
112
113
# File 'lib/utility/extension_mapping_util.rb', line 109

def self.mime_to_extension
  @mime_to_extension ||= @extension_to_mime.each_with_object({}) do |(key, values), memo|
    values.each { |value| memo[value] = key.to_s }
  end.with_indifferent_access.freeze
end