module Shrine::Plugins::InferExtension::ClassMethods

  1. lib/shrine/plugins/infer_extension.rb

Public Instance methods

extension_inferrer(name)
[show source]
   # File lib/shrine/plugins/infer_extension.rb
39 def extension_inferrer(name)
40   ExtensionInferrer.new(name).method(:call)
41 end
extension_inferrers()
[show source]
   # File lib/shrine/plugins/infer_extension.rb
33 def extension_inferrers
34   @extension_inferrers ||= ExtensionInferrer::SUPPORTED_TOOLS.inject({}) do |hash, tool|
35     hash.merge!(tool => extension_inferrer(tool))
36   end
37 end
infer_extension(mime_type)
[show source]
   # File lib/shrine/plugins/infer_extension.rb
25 def infer_extension(mime_type)
26   inferrer = opts[:infer_extension][:inferrer]
27   inferrer = extension_inferrer(inferrer) if inferrer.is_a?(Symbol)
28   args     = [mime_type, extension_inferrers].take(inferrer.arity.abs)
29 
30   instrument_extension(mime_type) { inferrer.call(*args) }
31 end