class Shrine::Plugins::StoreDimensions::DimensionsAnalyzer

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

Methods

Public Class

  1. new

Public Instance

  1. call

Constants

SUPPORTED_TOOLS = [:fastimage, :mini_magick, :ruby_vips]  

Public Class methods

new(tool, on_error: method(:fail))
[show source]
    # File lib/shrine/plugins/store_dimensions.rb
101 def initialize(tool, on_error: method(:fail))
102   raise Error, "unknown dimensions analyzer #{tool.inspect}, supported analyzers are: #{SUPPORTED_TOOLS.join(",")}" unless SUPPORTED_TOOLS.include?(tool)
103 
104   @tool     = tool
105   @on_error = on_error
106 end

Public Instance methods

call(io)
[show source]
    # File lib/shrine/plugins/store_dimensions.rb
108 def call(io)
109   dimensions = send(:"extract_with_#{@tool}", io)
110   io.rewind
111   dimensions
112 end