Module: Mongoid::Matcher::Or Private
- Defined in:
- lib/mongoid/matcher/or.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
In-memory matcher for $or expression.
Class Method Summary collapse
-
.matches?(document, expr) ⇒ true | false, Boolean
private
Returns whether a document satisfies an $or expression.
Class Method Details
.matches?(document, expr) ⇒ true | false, Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether a document satisfies an $or expression.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mongoid/matcher/or.rb', line 20 module_function def matches?(document, expr) unless expr.is_a?(Array) raise Errors::InvalidQuery, "$or argument must be an array: #{Errors::InvalidQuery.truncate_expr(expr)}" end if expr.empty? raise Errors::InvalidQuery, "$or argument must be a non-empty array: #{Errors::InvalidQuery.truncate_expr(expr)}" end expr.any? do |sub_expr| Expression.matches?(document, sub_expr) end end |