Class: Exiftool::Result
- Inherits:
-
Object
- Object
- Exiftool::Result
- Defined in:
- lib/exiftool/result.rb
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.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/exiftool/result.rb', line 7 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.
5 6 7 |
# File 'lib/exiftool/result.rb', line 5 def display2sym @display2sym end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/exiftool/result.rb', line 5 def raw @raw end |
#sym2display ⇒ Object (readonly)
Returns the value of attribute sym2display.
5 6 7 |
# File 'lib/exiftool/result.rb', line 5 def sym2display @sym2display end |
#to_display_hash ⇒ Object (readonly)
Returns the value of attribute to_display_hash.
5 6 7 |
# File 'lib/exiftool/result.rb', line 5 def to_display_hash @to_display_hash end |
#to_hash ⇒ Object (readonly)
Returns the value of attribute to_hash.
5 6 7 |
# File 'lib/exiftool/result.rb', line 5 def to_hash @to_hash end |
Instance Method Details
#[](key) ⇒ Object
28 29 30 |
# File 'lib/exiftool/result.rb', line 28 def [](key) @to_hash[key] end |
#errors? ⇒ Boolean
36 37 38 |
# File 'lib/exiftool/result.rb', line 36 def errors? self[:error] == 'Unknown file type' || self[:warning] == 'Unsupported file type' end |
#source_file ⇒ Object
32 33 34 |
# File 'lib/exiftool/result.rb', line 32 def source_file self[:source_file] end |