Method: ExifData#initialize
- Defined in:
- lib/exif_data.rb
#initialize(data) ⇒ ExifData
You can create new ExifData objects with either a json representation (String), a hash of key => value or an array of key,value pairs.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/exif_data.rb', line 29 def initialize(data) if data.kind_of?(String) replace JSON::parse(data) rescue {} elsif data.kind_of?(Hash) replace data elsif data.kind_of?(Array) replace Hash[*data.flatten] rescue {} else # ignore end end |