Sha256: f52f322db6b36a4f52276e91343de1388ab69861090b44d52419a2bf017715f2
Contents?: true
Size: 758 Bytes
Versions: 2
Compression:
Stored size: 758 Bytes
Contents
module Jeanine class Mimes MimeTypeNotFound = Class.new(StandardError) MIME_TYPES_INVERTED = Rack::Mime::MIME_TYPES.invert def self.load! register(:json, Rack::Mime::MIME_TYPES[".json"]) register(:html, Rack::Mime::MIME_TYPES[".html"]) register(:text, Rack::Mime::MIME_TYPES[".text"]) register(:plain, self.for(:text)) end def self.register(type, header) mime_types[type] = header end def self.for(type) mime_types.fetch(type) do raise(MimeTypeNotFound, "Mime #{type} not registered") end end def self.mime_types @mime_types ||= {} end private_class_method :mime_types def initialize(*) raise "Should not be initialiazed" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jeanine-0.2.0 | lib/jeanine/mimes.rb |
jeanine-0.1.0 | lib/jeanine/mimes.rb |