Class: Exiftool::Result
- Inherits:
-
Object
- Object
- Exiftool::Result
- Defined in:
- lib/exiftool/result.rb
Overview
Exiftool Result
Instance Attribute Summary collapse
-
#display2sym ⇒ Object
readonly
Returns the value of attribute display2sym.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#sym2display ⇒ Object
readonly
Returns the value of attribute sym2display.
-
#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.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/exiftool/result.rb', line 10 def initialize(raw_hash) @raw = {} @to_hash = {} @to_display_hash = {} @sym2display = {} raw_hash.each do |key, raw_value| p = FieldParser.new(key, raw_value) @raw[p.sym_key] = raw_value @to_hash[p.sym_key] = p.value @to_display_hash[p.display_key] = p.value @sym2display[p.sym_key] = p.display_key civil_date = p.civil_date if civil_date civil_date_key = "#{p.sym_key}_civil".to_sym @to_hash[civil_date_key] = civil_date end end @display2sym = @sym2display.invert end |
Instance Attribute Details
#display2sym ⇒ Object (readonly)
Returns the value of attribute display2sym.
8 9 10 |
# File 'lib/exiftool/result.rb', line 8 def display2sym @display2sym end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
8 9 10 |
# File 'lib/exiftool/result.rb', line 8 def raw @raw end |
#sym2display ⇒ Object (readonly)
Returns the value of attribute sym2display.
8 9 10 |
# File 'lib/exiftool/result.rb', line 8 def sym2display @sym2display end |
#to_display_hash ⇒ Object (readonly)
Returns the value of attribute to_display_hash.
8 9 10 |
# File 'lib/exiftool/result.rb', line 8 def to_display_hash @to_display_hash end |
#to_hash ⇒ Object (readonly)
Returns the value of attribute to_hash.
8 9 10 |
# File 'lib/exiftool/result.rb', line 8 def to_hash @to_hash end |
Instance Method Details
#[](key) ⇒ Object
31 32 33 |
# File 'lib/exiftool/result.rb', line 31 def [](key) @to_hash[key] end |
#errors? ⇒ Boolean
39 40 41 |
# File 'lib/exiftool/result.rb', line 39 def errors? self[:error] == 'Unknown file type' || self[:warning] == 'Unsupported file type' end |
#source_file ⇒ Object
35 36 37 |
# File 'lib/exiftool/result.rb', line 35 def source_file self[:source_file] end |