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
65 def initialize(tool)
66   raise Error, "unknown mime type analyzer #{tool.inspect}, supported analyzers are: #{SUPPORTED_TOOLS.join(",")}" unless SUPPORTED_TOOLS.include?(tool)
67 
68   @tool = tool
69 end

Public Instance methods

call (io)
[show source]
   # File lib/shrine/plugins/determine_mime_type.rb
71 def call(io)
72   mime_type = send(:"extract_with_#{@tool}", io)
73   io.rewind
74 
75   mime_type
76 end