Class: XmlNode::List

Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/vendor/xml_node/lib/xml_node.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ List

Returns a new instance of List.



58
59
60
61
# File 'lib/vendor/xml_node/lib/xml_node.rb', line 58

def initialize(parent)
  @parent = parent
  @children = {}
end

Instance Method Details

#[](value) ⇒ Object



63
64
65
# File 'lib/vendor/xml_node/lib/xml_node.rb', line 63

def [](value)
  node_for @parent.element.elements[value]
end

#[]=(value, key) ⇒ Object



67
68
69
# File 'lib/vendor/xml_node/lib/xml_node.rb', line 67

def []=(value, key)
  @parent.element.elements[value.to_s] = key.to_xml_element
end

#each(&block) ⇒ Object



71
72
73
# File 'lib/vendor/xml_node/lib/xml_node.rb', line 71

def each(&block)
  @parent.element.each_element { |e| yield node_for(e) }
end