Module: Mongoid::Matcher::And Private
- Defined in:
- lib/mongoid/matcher/and.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 $and expression.
Class Method Summary collapse
-
.matches?(document, expr) ⇒ true | false, Boolean
private
Returns whether a document satisfies an $and 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 $and expression.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mongoid/matcher/and.rb', line 20 module_function def matches?(document, expr) unless expr.is_a?(Array) raise Errors::InvalidQuery, "$and argument must be an array: #{Errors::InvalidQuery.truncate_expr(expr)}" end if expr.empty? raise Errors::InvalidQuery, "$and argument must be a non-empty array: #{Errors::InvalidQuery.truncate_expr(expr)}" end expr.all? do |sub_expr| Expression.matches?(document, sub_expr) end end |