Class: ImageResizer::Encoder

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

Instance Attribute Summary

Attributes included from Loggable

#log_object

Instance Method Summary collapse

Methods included from Configurable

included

Methods included from Loggable

#log, #log=, #use_same_log_as

Instance Method Details

#encode(temp_object, format, args = '') ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/image_resizer/encoder.rb', line 42

def encode(temp_object, format, args='')
  format = format.to_s.downcase
  throw :unable_to_handle unless supported_formats.include?(format.to_sym)
  details = identify(temp_object)

  if details[:format] == format.to_sym && args.empty?
    temp_object
  else
    convert(temp_object, args, format)
  end
end