Class: Dragonfly::Minimagick::Encoder

Inherits:
Object
  • Object
show all
Includes:
Configurable, Utils
Defined in:
lib/dragonfly-minimagick/encoder.rb

Instance Method Summary collapse

Instance Method Details

#encode(temp_object, format, encoding = {}) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/dragonfly-minimagick/encoder.rb', line 47

def encode(temp_object, format, encoding={})
  format = format.to_s.downcase
  throw :unable_to_handle unless supported_formats.include?(format.to_sym)
  minimagick_image(temp_object) do |image|
    if image[:format].downcase == format
      temp_object # do nothing
    else
      image.format(format)
      image
    end
  end
end