Class: VTD::Xml::Node
- Inherits:
-
Object
- Object
- VTD::Xml::Node
- Includes:
- Attributes
- Defined in:
- lib/vtd/xml/node.rb,
lib/vtd/xml/node/attributes.rb
Defined Under Namespace
Modules: Attributes
Constant Summary
Constants included from Attributes
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #children(options = {}) ⇒ Object
-
#initialize(nav, auto_pilot, current) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
Methods included from Attributes
#[], #attributes, #fetch, #slice
Constructor Details
#initialize(nav, auto_pilot, current) ⇒ Node
Returns a new instance of Node.
10 11 12 13 14 |
# File 'lib/vtd/xml/node.rb', line 10 def initialize(nav, auto_pilot, current) @nav = nav @auto_pilot = auto_pilot @current = current end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/vtd/xml/node.rb', line 8 def name @name end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'lib/vtd/xml/node.rb', line 8 def text @text end |
Instance Method Details
#children(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vtd/xml/node.rb', line 24 def children( = {}) Enumerator.new do |yielder| @nav.push next_element unless child_selected?() yielder << dup while next_element @nav.pop end end |
#inspect ⇒ Object
35 36 37 |
# File 'lib/vtd/xml/node.rb', line 35 def inspect %(#<#{self.class}:#{self.object_id} @current=#{@current} @nav=#{@nav}>) end |