Sha256: 4c25c5a6b6e15a8321eb27586fe5a02868dedc9983fbf3d97b537ba904f4436e
Contents?: true
Size: 939 Bytes
Versions: 1
Compression:
Stored size: 939 Bytes
Contents
require "rack/mime" unless defined?(::Rack::Mime) require "multi_mime/adapter" require "multi_mime/null_type" module MultiMime module Adapters # Use the Rack::Mime library class RackMime < Adapter # def type_for(mime_type, opts={}) type = ::Rack::Mime::MIME_TYPES.key(mime_type) # Rack::Mime actually doesnt allow you to simply verify that a mime type exists type ? mime_type : MultiMime::NullType.new end # def type_for_extension(extension, opts={}) extension.insert(0, ".") unless extension[0] == "." # requires the extension with a dot ::Rack::Mime.mime_type(extension, MultiMime::NullType.new) # set the fallback to nil end # def type_for_path(path, opts={}) type_for_extension(File.extname(path)) end # def type_for_file(file, opts={}) type_for_extension(File.extname(file)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi_mime-0.0.2 | lib/multi_mime/adapters/rack_mime.rb |