Module: XMP::Handler
- Included in:
- XMP
- Defined in:
- lib/xmp/handler.rb,
lib/xmp/handler/xml.rb,
lib/xmp/handler/file.rb,
lib/xmp/handler/exifr_jpeg.rb,
lib/xmp/handler/exifr_tiff.rb
Defined Under Namespace
Classes: ExifrJPEG, ExifrTIFF, File, XML
Instance Attribute Summary collapse
-
#handlers ⇒ Object
Returns the value of attribute handlers.
Instance Method Summary collapse
- #new(object) ⇒ Object (also: #parse)
Instance Attribute Details
#handlers ⇒ Object
Returns the value of attribute handlers.
2 3 4 |
# File 'lib/xmp/handler.rb', line 2 def handlers @handlers end |
Instance Method Details
#new(object) ⇒ Object Also known as: parse
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/xmp/handler.rb', line 4 def new(object) last_error = nil result = object handlers.each do |handler| begin next unless new_result = handler.call(result) return new_result if new_result.is_a? XMP::Document result = new_result rescue XMP::Error => error last_error = error end end raise last_error if last_error raise XMP::Error, "cannot handle #{object.inspect}" end |