From 9cb589cb343c08bd0c059af5da95fa90a0af6ac7 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 18 Aug 2015 14:08:11 +0200 Subject: [PATCH] XPath compiler support for name() --- lib/oga/xpath/compiler.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index 122933f..f499fb1 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -860,6 +860,20 @@ module Oga end end + # @param [Oga::Ruby::Node] input + # @param [AST::Node] arg + # @return [Oga::Ruby::Node] + def on_call_name(input, arg = nil) + first_node_or_argument(input, arg) do |arg_var| + arg_var + .if_true do + ensure_element_or_attribute(arg_var) + .followed_by { block_given? ? yield : arg_var.expanded_name } + end + .else { string('') } + end + end + ## # Delegates type tests to specific handlers. #