Class: Saxon::XPath::Result

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/saxon/xpath/executable.rb

Overview

The result of executing an XPath query as an enumerable object

Instance Method Summary collapse

Constructor Details

#initialize(result_iterator) ⇒ Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Result.

Parameters:

  • result_iterator (java.util.Iterator)

    the result of calling #iterator on a Saxon XPathSelector



47
48
49
# File 'lib/saxon/xpath/executable.rb', line 47

def initialize(result_iterator)
  @result_iterator = result_iterator
end

Instance Method Details

#each {|xdm_node| ... } ⇒ Object

Yields XdmNodes from the query result. If no block is passed, returns an Enumerator

Yield Parameters:



54
55
56
# File 'lib/saxon/xpath/executable.rb', line 54

def each(&block)
  @result_iterator.lazy.map { |s9_xdm_node| Saxon::XdmNode.new(s9_xdm_node) }.each(&block)
end