From 02ee35122a3488f26d2c43380e28935ce157a10d Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 3 Aug 2015 09:43:31 +0200 Subject: [PATCH] XPath compiler support for the self axis --- lib/oga/xpath/compiler.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index 583640a..2d5074c 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -257,6 +257,17 @@ module Oga end end + # @param [AST::Node] ast + # @param [Oga::Ruby::Node] input + # @return [Oga::Ruby::Node] + def on_axis_self(ast, input, &block) + node = node_literal + + backup_variable(node, input) do + process(ast, node, &block).if_true { yield node } + end + end + # @param [AST::Node] ast # @param [Oga::Ruby::Node] input # @return [Oga::Ruby::Node]