ruby-avm-library/lib/avm/image.rb

30 lines
446 B
Ruby
Raw Normal View History

2011-03-07 17:39:47 +00:00
require 'avm/creator'
2011-03-10 22:45:21 +00:00
require 'avm/xmp'
2011-03-07 17:39:47 +00:00
module AVM
class Image
attr_reader :creator
def initialize
2011-03-10 22:45:21 +00:00
@creator = AVM::Creator.new(self)
2011-03-07 17:39:47 +00:00
end
2011-03-09 15:14:31 +00:00
def to_xml
2011-03-10 22:45:21 +00:00
document = AVM::XMP.new
2011-03-09 15:14:31 +00:00
2011-03-10 22:45:21 +00:00
creator.add_to_document(document)
2011-03-09 15:14:31 +00:00
2011-03-10 22:45:21 +00:00
document.doc
2011-03-09 15:14:31 +00:00
end
2011-03-11 18:27:17 +00:00
def self.from_xml(string)
document = AVM::XMP.from_string(string)
image = new
image.creator.from_xml(self, document)
image
end
2011-03-07 17:39:47 +00:00
end
end