Class: ImageSqueeze::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/image_squeeze/processors/processor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



3
4
5
# File 'lib/image_squeeze/processors/processor.rb', line 3

def filename
  @filename
end

Class Method Details

.handles?(image_type) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/image_squeeze/processors/processor.rb', line 9

def self.handles?(image_type)
  image_type == input_type
end

.input_typeObject



13
14
15
# File 'lib/image_squeeze/processors/processor.rb', line 13

def self.input_type
  raise "#{to_s}#input_type should be defined in subclass"
end

.output_extensionObject

override if you want a different output extensions



18
19
20
# File 'lib/image_squeeze/processors/processor.rb', line 18

def self.output_extension
  ImageSqueeze::IMAGE_TYPE_TO_EXTENSION[input_type]
end

.squeeze(filename, output_filename) ⇒ Object



5
6
7
# File 'lib/image_squeeze/processors/processor.rb', line 5

def self.squeeze(filename, output_filename)
  raise "#{to_s}#squeeze should be defined in subclass and should convert filename to something at output_filename"
end