Class: Griddle::Processor
- Inherits:
-
Object
- Object
- Griddle::Processor
- Defined in:
- lib/griddle/processor.rb,
lib/griddle/processor/image_magick.rb
Defined Under Namespace
Classes: ImageMagick
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(processor_class = :ImageMagick) ⇒ Processor
constructor
A new instance of Processor.
- #process_image(file, style) ⇒ Object
Constructor Details
#initialize(processor_class = :ImageMagick) ⇒ Processor
Returns a new instance of Processor.
6 7 8 9 |
# File 'lib/griddle/processor.rb', line 6 def initialize( processor_class = :ImageMagick ) processor_class = :ImageMagick unless valid_processors.include? processor_class self.klass = self.class.const_get "#{processor_class}" end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
4 5 6 |
# File 'lib/griddle/processor.rb', line 4 def klass @klass end |
Instance Method Details
#process_image(file, style) ⇒ Object
11 12 13 14 15 |
# File 'lib/griddle/processor.rb', line 11 def process_image file, style processor = self.klass.new raise "Define in subclass" unless processor.respond_to? :process_image processor.process_image(file, style) end |