Support for the XPath "or" operator.
This commit is contained in:
1 parent
4f189d9218
commit
4fa40b58cf
2 files changed
+57
No files matched your search
@@ -609,6 +609,23 @@ module Oga
|
||||
return on_call_boolean(context, left) && on_call_boolean(context, right)
|
||||
end
|
||||
|
||||
##
|
||||
# Processes the `or` operator.
|
||||
#
|
||||
# This operator returns `true` if one of the expressions evaluates to
|
||||
# true, otherwise false is returned. If the first expression evaluates to
|
||||
# `true` the second expression is ignored.
|
||||
#
|
||||
# @param [Oga::XPath::Node] ast_node
|
||||
# @param [Oga::XML::NodeSet] context
|
||||
# @return [TrueClass|FalseClass]
|
||||
#
|
||||
def on_or(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