Module: OM::XML::Container::ClassMethods
- Defined in:
- lib/om/xml/container.rb
Overview
Class Methods – These methods will be available on classes that include this Module
Instance Method Summary collapse
-
#from_xml(xml, tmpl = self.new) ⇒ Object
Careful! If you call this from a constructor, be sure to provide something ‘ie.
Instance Method Details
#from_xml(xml, tmpl = self.new) ⇒ Object
Careful! If you call this from a constructor, be sure to provide something ‘ie. self’ as the @tmpl. Otherwise, you will get an infinite loop!
12 13 14 15 16 17 18 19 |
# File 'lib/om/xml/container.rb', line 12 def from_xml(xml, tmpl=self.new) # :nodoc: if xml.kind_of? Nokogiri::XML::Node tmpl.ng_xml = xml else tmpl.ng_xml = Nokogiri::XML::Document.parse(xml) end return tmpl end |