class Shrine::Plugins::DetermineMimeType::MimeTypeAnalyzer

  1. lib/shrine/plugins/determine_mime_type.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. call

Constants

MAGIC_NUMBER = 256 * 1024  
SUPPORTED_TOOLS = [:fastimage, :file, :filemagic, :mimemagic, :marcel, :mime_types, :mini_mime, :content_type]  

Public Class methods

new (tool)
[show source]
   # File lib/shrine/plugins/determine_mime_type.rb
71 def initialize(tool)
72   raise Error, "unknown mime type analyzer #{tool.inspect}, supported analyzers are: #{SUPPORTED_TOOLS.join(",")}" unless SUPPORTED_TOOLS.include?(tool)
73 
74   @tool = tool
75 end

Public Instance methods

call (io, options = {})
[show source]
   # File lib/shrine/plugins/determine_mime_type.rb
77 def call(io, options = {})
78   mime_type = send(:"extract_with_#{@tool}", io, options)
79   io.rewind
80 
81   mime_type
82 end