Support for the XPath concat() function.

This commit is contained in:
Yorick Peterse committed 2014-08-23 20:24:18 +02:00
1 parent 431a253000
commit b688c6dc1b
2 files changed
+53 -2

No files matched your search

+23 -2
View File
@@ -786,8 +786,29 @@ module Oga
end
##
# Processes an `(int)` node. This method simply returns the value as a
# Float.
# Processes the `concat()` function call.
#
# This function call converts its arguments to strings and concatenates
# them. In case of node sets the text of the set is used.
#
# @param [Oga::XML::NodeSet] context
# @param [Oga::XPath::Node] first
# @param [Oga::XPath::Node] second
# @param [Array<Oga::XPath::Node>] rest
#
def on_call_concat(context, first, second, *rest)
args = [first, second] + rest
retval = ''
args.each do |arg|
retval << on_call_string(context, arg)
end
return retval
end
##
# Processes an `(int)` node.
#
# @param [Oga::XPath::Node] ast_node
# @param [Oga::XML::NodeSet] context