Class: VTD::Xml::Node

Inherits:
Object
  • Object
show all
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

Attributes::AttributeMissing

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/vtd/xml/node.rb', line 8

def name
  @name
end

#textObject (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(options = {})
  Enumerator.new do |yielder|
    @nav.push
    next_element unless child_selected?(options)

    yielder << dup while next_element

    @nav.pop
  end
end

#inspectObject



35
36
37
# File 'lib/vtd/xml/node.rb', line 35

def inspect
  %(#<#{self.class}:#{self.object_id} @current=#{@current} @nav=#{@nav}>)
end