Class: ImageGenie::Identify
- Inherits:
-
Command
- Object
- Command
- ImageGenie::Identify
- Defined in:
- lib/image_genie/identify.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
Instance Method Summary collapse
-
#initialize(filename, options = {}) ⇒ Identify
constructor
A new instance of Identify.
- #run ⇒ Object
Constructor Details
#initialize(filename, options = {}) ⇒ Identify
Returns a new instance of Identify.
7 8 9 10 11 12 13 |
# File 'lib/image_genie/identify.rb', line 7 def initialize(filename, ={}) self.exception_class = IdentifyError raise(UnableToLocateBinaryError, 'identify') if path_for(:identify).blank? self.filename = filename raise Errno::ENOENT,"#{filename}" unless File.exists?(filename) super(self) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
5 6 7 |
# File 'lib/image_genie/identify.rb', line 5 def filename @filename end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 |
# File 'lib/image_genie/identify.rb', line 15 def run command = "#{path_for(:identify)} #{filename}" execute(command) fields = [:filename,:format,:dimensions,:geometry,:bit,:image_class,:colors,:filesize,:usertime,:identify_time] return Hash[fields.zip(output_buffer.split(' '))] end |