Class: OpenNebula::XMLPool
- Inherits:
-
XMLElement
- Object
- XMLElement
- OpenNebula::XMLPool
- Defined in:
- lib/opennebula/xml_pool.rb
Overview
The XMLUtilsPool module provides an abstraction of the underlying XML parser engine. It provides XML-related methods for the Pools
Direct Known Subclasses
Instance Method Summary collapse
-
#each_element(block) ⇒ Object
- Executes the given block for each element of the Pool block
-
Block.
-
#initialize(xml = nil) ⇒ XMLPool
constructor
A new instance of XMLPool.
Methods inherited from XMLElement
#[], #add_element, #attr, build_xml, #delete_element, #each, #each_xpath, #element_xml, #has_elements?, #initialize_xml, #name, #retrieve_elements, #retrieve_xmlelements, #set_content, #template_like_str, #template_str, #template_xml, #text, #to_hash, #to_xml, #xml_nil?
Constructor Details
#initialize(xml = nil) ⇒ XMLPool
Returns a new instance of XMLPool.
25 26 27 |
# File 'lib/opennebula/xml_pool.rb', line 25 def initialize(xml=nil) super(xml) end |
Instance Method Details
#each_element(block) ⇒ Object
Executes the given block for each element of the Pool
- block
-
Block
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/opennebula/xml_pool.rb', line 31 def each_element(block) if NOKOGIRI @xml.xpath( "#{@element_name}").each {|pelem| block.call self.factory(pelem) } else @xml.elements.each( "#{@element_name}") {|pelem| block.call self.factory(pelem) } end end |