Class: Miso::Processor
- Inherits:
-
Object
show all
- Defined in:
- lib/miso/processor.rb,
lib/miso/processor/core_image.rb,
lib/miso/processor/image_magick.rb,
lib/miso/processor/graphics_magick.rb
Defined Under Namespace
Classes: CoreImage, GraphicsMagick, ImageMagick
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(input_file) ⇒ Processor
Returns a new instance of Processor.
40
41
42
43
|
# File 'lib/miso/processor.rb', line 40
def initialize(input_file)
@input_file = File.expand_path(input_file)
raise Errno::ENOENT, @input_file unless File.exist?(@input_file)
end
|
Class Attribute Details
.processor_class ⇒ Object
The default processor class.
Returns either the assigned processor, or otherwise finds the first processor, that is available on the machine, from the processor_classes array.
19
20
21
22
23
|
# File 'lib/miso/processor.rb', line 19
def processor_class
@processor_class ||= processor_classes.find { |c| c.available? }
raise "None of the Miso::Processor classes are available." unless @processor_class
@processor_class
end
|
.processor_classes ⇒ Object
The list of processor classes.
When no explicit processor_class is set this list is iterated, from first to last, and the first available processor on the machine is used.
Instance Attribute Details
Returns the value of attribute input_file.
38
39
40
|
# File 'lib/miso/processor.rb', line 38
def input_file
@input_file
end
|
Class Method Details
.available? ⇒ Boolean
33
34
35
|
# File 'lib/miso/processor.rb', line 33
def available?
raise NotImplementedError, "The class `#{name}' does not implement ::available?."
end
|
Instance Method Details
#auto_orient ⇒ Object
53
54
55
|
# File 'lib/miso/processor.rb', line 53
def auto_orient
raise NotImplementedError, "The class `#{self.class.name}' does not implement #auto_orient."
end
|
#crop(width, height) ⇒ Object
45
46
47
|
# File 'lib/miso/processor.rb', line 45
def crop(width, height)
raise NotImplementedError, "The class `#{self.class.name}' does not implement #crop."
end
|
#dimensions ⇒ Object
57
58
59
|
# File 'lib/miso/processor.rb', line 57
def dimensions
raise NotImplementedError, "The class `#{self.class.name}' does not implement #dimensions."
end
|
#fit(width, height) ⇒ Object
49
50
51
|
# File 'lib/miso/processor.rb', line 49
def fit(width, height)
raise NotImplementedError, "The class `#{self.class.name}' does not implement #fit."
end
|
#height ⇒ Object
69
70
71
|
# File 'lib/miso/processor.rb', line 69
def height
dimensions.last
end
|
#width ⇒ Object
65
66
67
|
# File 'lib/miso/processor.rb', line 65
def width
dimensions.first
end
|
#write(output_file) ⇒ Object
61
62
63
|
# File 'lib/miso/processor.rb', line 61
def write(output_file)
raise NotImplementedError, "The class `#{self.class.name}' does not implement #write."
end
|