Class: Exiftoolr::Result
- Inherits:
-
Object
- Object
- Exiftoolr::Result
- Defined in:
- lib/exiftoolr/result.rb
Instance Attribute Summary collapse
-
#symbol_display_hash ⇒ Object
readonly
Returns the value of attribute symbol_display_hash.
-
#to_display_hash ⇒ Object
readonly
Returns the value of attribute to_display_hash.
-
#to_hash ⇒ Object
readonly
Returns the value of attribute to_hash.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #errors? ⇒ Boolean
-
#initialize(raw_hash) ⇒ Result
constructor
A new instance of Result.
- #source_file ⇒ Object
Constructor Details
#initialize(raw_hash) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/exiftoolr/result.rb', line 8 def initialize(raw_hash) @raw_hash = raw_hash @to_hash = {} @to_display_hash = {} @symbol_display_hash = {} @raw_hash.each do |key, raw_value| p = Parser.new(key, raw_value) @to_hash[p.sym_key] = p.value @to_display_hash[p.display_key] = p.value @symbol_display_hash[p.sym_key] = p.display_key end end |
Instance Attribute Details
#symbol_display_hash ⇒ Object (readonly)
Returns the value of attribute symbol_display_hash.
6 7 8 |
# File 'lib/exiftoolr/result.rb', line 6 def symbol_display_hash @symbol_display_hash end |
#to_display_hash ⇒ Object (readonly)
Returns the value of attribute to_display_hash.
6 7 8 |
# File 'lib/exiftoolr/result.rb', line 6 def to_display_hash @to_display_hash end |
#to_hash ⇒ Object (readonly)
Returns the value of attribute to_hash.
6 7 8 |
# File 'lib/exiftoolr/result.rb', line 6 def to_hash @to_hash end |
Instance Method Details
#[](key) ⇒ Object
21 22 23 |
# File 'lib/exiftoolr/result.rb', line 21 def [](key) @to_hash[key] end |
#errors? ⇒ Boolean
29 30 31 |
# File 'lib/exiftoolr/result.rb', line 29 def errors? self[:error] == "Unknown file type" || self[:warning] == "Unsupported file type" end |
#source_file ⇒ Object
25 26 27 |
# File 'lib/exiftoolr/result.rb', line 25 def source_file self[:source_file] end |