Class: Dragonfly::Encoding::RMagickEncoder

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly/encoding/r_magick_encoder.rb

Instance Method Summary collapse

Instance Method Details

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



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/dragonfly/encoding/r_magick_encoder.rb', line 46

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