Support for the XPath not() function.
This commit is contained in:
1 parent
80d235bf06
commit
4ef79bad90
2 files changed
+45
No files matched your search
@@ -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.
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user