Support for the XPath "or" operator.

This commit is contained in:
Yorick Peterse committed 2014-08-28 21:01:12 +02:00
1 parent 4f189d9218
commit 4fa40b58cf
2 files changed
+57

No files matched your search

+17
View File
@@ -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.
#