Module: ROXML::InstanceMethods

Defined in:
lib/roxml.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#to_xml(name = self.class.tag_name) ⇒ Object

Returns a LibXML::XML::Node or a REXML::Element representing this object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/roxml.rb', line 24

def to_xml(name = self.class.tag_name)
  returning XML::Node.new(name.to_s) do |root|
    self.class.roxml_attrs.each do |attr|
      ref = attr.to_ref(self)
      value = ref.to_xml
      unless value.nil?
        ref.update_xml(root, value)
      end
    end
  end
end