Class: XPath::PrecedingIterator

Inherits:
ReverseAxisIterator show all
Defined in:
lib/xml/xpath.rb

Instance Method Summary collapse

Methods inherited from ReverseAxisIterator

#reverse_order?

Methods inherited from AxisIterator

#reverse_order?

Instance Method Details

#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