Module: SellObject::XmlFormatter
- Defined in:
- lib/sell_object/xml_formatter.rb
Class Method Summary collapse
Class Method Details
.format(obj, engine, xml_root, formatter_proxy = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/sell_object/xml_formatter.rb', line 3 def self.format(obj, engine, xml_root, formatter_proxy = nil) mapping = SellObject.mapping_for obj, engine formatter_proxy ||= SellObject::FormatterProxy.new obj xml_builder = Nokogiri::XML::Builder.new do |xml| xml.send xml_root do mapping.each do |tag, mapped_method| xml.send tag, formatter_proxy.send(tag, mapped_method) end end end xml_builder.doc.root.to_xml end |