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 collapse

TYPES =
{
  first_child: com.ximpleware.VTDNav::FIRST_CHILD,
  parent: com.ximpleware.VTDNav::PARENT
}

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.



15
16
17
18
19
20
# File 'lib/vtd/xml/node.rb', line 15

def initialize(nav, auto_pilot, current)
  @nav        = nav
  @auto_pilot = auto_pilot
  @current    = current
  super
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/vtd/xml/node.rb', line 13

def name
  @name
end

#textObject (readonly)

Returns the value of attribute text.



13
14
15
# File 'lib/vtd/xml/node.rb', line 13

def text
  @text
end

Instance Method Details

#inspectObject



37
38
39
# File 'lib/vtd/xml/node.rb', line 37

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

#with_first_child(name = nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/vtd/xml/node.rb', line 30

def with_first_child(name = nil)
  if move_to(:first_child, name)
    yield dup
    move_to(:parent)
  end
end