Support for the XPath not() function.

This commit is contained in:
Yorick Peterse committed 2014-08-27 09:35:02 +02:00
1 parent 80d235bf06
commit 4ef79bad90
2 files changed
+45

No files matched your search

+19
View File
@@ -1045,6 +1045,10 @@ module Oga
#
# The boolean `false` is returned for all other cases.
#
# @param [Oga::XML::NodeSet] context
# @param [Oga::XPath::Node] expression
# @return [TrueClass|FalseClass]
#
def on_call_boolean(context, expression)
retval = process(expression, context)
@@ -1055,6 +1059,21 @@ module Oga
end
end
##
# Processes the `not()` function call.
#
# This function converts the 1st argument to a boolean and returns the
# opposite boolean value. For example, if the first argument results in
# `true` then this function returns `false` instead.
#
# @param [Oga::XML::NodeSet] context
# @param [Oga::XPath::Node] expression
# @return [TrueClass|FalseClass]
#
def on_call_not(context, expression)
return !on_call_boolean(context, expression)
end
##
# Processes an `(int)` node.
#