module OM::XML::Container

Attributes

ng_xml[RW]

Public Instance Methods

to_xml(xml = ng_xml) click to toggle source

Instance Methods – These methods will be available on instances of classes that include this module

# File lib/om/xml/container.rb, line 40
def to_xml(xml = ng_xml)
  if xml == ng_xml
    return xml.to_xml
  elsif ng_xml.root.nil?
      return xml.to_xml
  elsif xml.kind_of?(Nokogiri::XML::Document)
      xml.root.add_child(ng_xml.root)
      return xml.to_xml
  elsif xml.kind_of?(Nokogiri::XML::Node)
      xml.add_child(ng_xml.root)
      return xml.to_xml
  else
      raise "You can only pass instances of Nokogiri::XML::Node into this method.  You passed in #{xml}"
  end
end