Module: Mongoid::Matcher::Or Private
- Defined in:
- build/mongoid-8.1/lib/mongoid/matcher/or.rb
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.
Class Method Summary collapse
Class Method Details
.matches?(document, expr) ⇒ 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.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'build/mongoid-8.1/lib/mongoid/matcher/or.rb', line 6 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 |