Class: Flickrie::Media::Exif

Inherits:
Object
  • Object
show all
Defined in:
lib/flickrie/objects/media/exif.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hashHash (readonly)

Returns:



26
27
28
# File 'lib/flickrie/objects/media/exif.rb', line 26

def hash
  @hash
end

Instance Method Details

#[](key) ⇒ Object



24
# File 'lib/flickrie/objects/media/exif.rb', line 24

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

#get(key, options = {}) ⇒ Object

Gets exif. Example:

photo.exif.get('Model') # => 'Canon PowerShot G12'

photo.exif.get('X-Resolution', data: 'raw')   # => '180'
photo.exif.get('X-Resolution', data: 'clean') # => '180 dpi'
photo.exif.get('X-Resolution')                   # => '180 dpi'


15
16
17
18
19
20
21
22
# File 'lib/flickrie/objects/media/exif.rb', line 15

def get(key, options = {})
  hash = @info.find { |hash| hash['label'] == key }
  data = hash[options[:data]] || hash['clean'] || hash['raw']
  data['_content']

rescue NoMethodError
  nil
end