Class: Rack::PageCaching::MimeTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/page_caching/mime_types.rb

Class Method Summary collapse

Class Method Details

.extension_for(content_type) ⇒ Object



19
20
21
# File 'lib/rack/page_caching/mime_types.rb', line 19

def self.extension_for(content_type)
  @extension_lookup[content_type].first
end

.load!Object



6
7
8
9
10
11
12
13
# File 'lib/rack/page_caching/mime_types.rb', line 6

def self.load!
  mime_types = Rack::Mime::MIME_TYPES
  extensions = Hash.new { |hash, key| hash[key] = [] }
  mime_types.each do |extension, content_type|
    extensions[content_type] << extension
  end
  @extension_lookup = extensions
end

.register(content_type, extension) ⇒ Object



15
16
17
# File 'lib/rack/page_caching/mime_types.rb', line 15

def self.register(content_type, extension)
  @extension_lookup[content_type] = [extension]
end