Class: Exiftool::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/exiftool/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
# File 'lib/exiftool/result.rb', line 7

def initialize(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)
    @raw_hash[p.sym_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

#raw_hashObject (readonly)

Returns the value of attribute raw_hash.



5
6
7
# File 'lib/exiftool/result.rb', line 5

def raw_hash
  @raw_hash
end

#symbol_display_hashObject (readonly)

Returns the value of attribute symbol_display_hash.



5
6
7
# File 'lib/exiftool/result.rb', line 5

def symbol_display_hash
  @symbol_display_hash
end

#to_display_hashObject (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_hashObject (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



21
22
23
# File 'lib/exiftool/result.rb', line 21

def [](key)
  @to_hash[key]
end

#errors?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/exiftool/result.rb', line 29

def errors?
  self[:error] == 'Unknown file type' || self[:warning] == 'Unsupported file type'
end

#source_fileObject



25
26
27
# File 'lib/exiftool/result.rb', line 25

def source_file
  self[:source_file]
end