Class: VTD::Xml::Finder

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/vtd/xml/finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(nav, xpath) ⇒ Finder

Returns a new instance of Finder.



6
7
8
9
10
11
12
# File 'lib/vtd/xml/finder.rb', line 6

def initialize(nav, xpath)
  @nav = nav
  @xpath = xpath

  @auto_pilot = com.ximpleware.AutoPilot.new(@nav)
  @auto_pilot.select_xpath(@xpath)
end

Instance Method Details

#eachObject



14
15
16
17
18
# File 'lib/vtd/xml/finder.rb', line 14

def each
  while (current = @auto_pilot.eval_xpath) != -1
    yield Node.new(@nav, @auto_pilot, current)
  end
end