Method: XMP.parse

Defined in:
lib/xmp.rb

.parse(doc) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/xmp.rb', line 53

def self.parse(doc)
  case doc.class.to_s
  when 'EXIFR::JPEG'
    if xmp_chunk = doc.app1s.find { |a| a =~ %r|\Ahttp://ns.adobe.com/xap/1.0/| }
      xmp_data = xmp_chunk.split("\000")[1]
      XMP.new(xmp_data)
    end
  else
    raise "Document not supported:\n#{doc.inspect}"
  end
end