Sha256: 869d7fee2b6ef196bfcd8cf373c23240b2ae8c977abdf0f1f0eac83cbd4b9b4e
Contents?: true
Size: 849 Bytes
Versions: 15
Compression:
Stored size: 849 Bytes
Contents
module Jeanine class Mimes MimeTypeNotFound = Class.new(StandardError) MIME_TYPES_INVERTED = ::Rack::Mime::MIME_TYPES.invert def self.loaded? @loaded end def self.load! return if loaded? @loaded = true 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
15 entries across 15 versions & 1 rubygems