Support for the XPath "and" operator.
This commit is contained in:
1 parent
809ed9bfa6
commit
4f189d9218
2 files changed
+49
No files matched your search
@@ -592,6 +592,23 @@ module Oga
|
||||
return process(left, context) + process(right, context)
|
||||
end
|
||||
|
||||
##
|
||||
# Processes the `and` operator.
|
||||
#
|
||||
# This operator returns true if both the left and right expression
|
||||
# evaluate to `true`. If the first expression evaluates to `false` the
|
||||
# right expression is ignored.
|
||||
#
|
||||
# @param [Oga::XPath::Node] ast_node
|
||||
# @param [Oga::XML::NodeSet] context
|
||||
# @return [TrueClass|FalseClass]
|
||||
#
|
||||
def on_and(ast_node, context)
|
||||
left, right = *ast_node
|
||||
|
||||
return on_call_boolean(context, left) && on_call_boolean(context, right)
|
||||
end
|
||||
|
||||
##
|
||||
# Delegates function calls to specific handlers.
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user