Sha256: 43b7a3be2dd9c1b5b5c5529d601c314f5644ada7d6c69c1186e559a63f62e06c
Contents?: true
Size: 711 Bytes
Versions: 5
Compression:
Stored size: 711 Bytes
Contents
require 'multi_mime/adapter' module MultiMime module Adapters # Use the Mimemagic library class Mimemagic < Adapter def type_for(mime_type, opts = {}) type = ::MimeMagic::EXTENSIONS.key(mime_type) # Mimemagic 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 = {}) ::MimeMagic.by_extension(extension) || MultiMime::NullType.new 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
5 entries across 5 versions & 1 rubygems