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
 99 def initialize(tool, on_error: method(:fail))
100   raise Error, "unknown dimensions analyzer #{tool.inspect}, supported analyzers are: #{SUPPORTED_TOOLS.join(",")}" unless SUPPORTED_TOOLS.include?(tool)
101 
102   @tool     = tool
103   @on_error = on_error
104 end

Public Instance methods

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