Method: XPath::PrecedingIterator#each
- Defined in:
- lib/xml/xpath.rb
#each(node, visitor) ⇒ Object
2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 |
# File 'lib/xml/xpath.rb', line 2671 def each(node, visitor) while parent = (adaptor = visitor.visit(node)).parent adaptor.each_preceding_siblings { |i| stack = visitor.visit(i).children.dup while node = stack.pop a = visitor.visit(node) stack.concat a.children yield a end yield visitor.visit(i) } node = parent end end |