class Gammo::XPath::AST::Axis::Preceding

Public Instance Methods

strain(context, context_node, node_set) click to toggle source
# File lib/gammo/xpath/ast/axis.rb, line 188
def strain(context, context_node, node_set)
  context_node = context_node.owner_element if context_node.instance_of?(Gammo::Attribute)
  each_preceding(context_node) do |node|
    node_set << node if node_test.match?(node)
  end
end

Private Instance Methods

each_preceding(context_node) { |node| ... } click to toggle source
# File lib/gammo/xpath/ast/axis.rb, line 197
def each_preceding(context_node)
  node = context_node
  while parent = node.parent
    while node = node.previous_sibling
      yield node
      break if node == parent
    end
    node = parent
  end
end