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