Class: Gammo::XPath::AST::Axis::Ancestor

Inherits:
Gammo::XPath::AST::Axis
  • Object
show all
Defined in:
lib/gammo/xpath/ast/axis.rb

Constant Summary

Constants included from Subclassify

Subclassify::NotFoundError

Instance Method Summary collapse

Instance Method Details

#strain(context, context_node, node_set) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/gammo/xpath/ast/axis.rb', line 43

def strain(context, context_node, node_set)
  if context_node.instance_of?(Gammo::Attribute)
    context_node = context_node.owner_element
    node_set << context_node if node_test.match?(context_node)
  end
  node = context_node
  while node = node.parent
    node_set << node if node_test.match?(node)
  end
end