Module: Xeroizer::Record::XmlHelper::InstanceMethods
- Defined in:
- lib/xeroizer/record/xml_helper.rb
Instance Method Summary collapse
-
#to_xml(b = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object
Turn a record into its XML representation.
Instance Method Details
#to_xml(b = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object
Turn a record into its XML representation.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/xeroizer/record/xml_helper.rb', line 62 def to_xml(b = Builder::XmlMarkup.new(:indent => 2)) optional_root_tag(parent.class.optional_xml_root_name, b) do |b| b.tag!(model.class.xml_node_name || model.model_name) { attributes.each do | key, value | field = self.class.fields[key] value = self.send(key) if field[:calculated] xml_value_from_field(b, field, value) unless value.nil? end } end end |