Module: Mongoid::Matcher::In Private
- Defined in:
- lib/mongoid/matcher/in.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 $in expression.
Class Method Summary collapse
-
.matches?(_exists, value, condition) ⇒ true | false, Boolean
private
Returns whether a value satisfies an $in expression.
Class Method Details
.matches?(_exists, value, condition) ⇒ 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 value satisfies an $in expression.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mongoid/matcher/in.rb', line 18 module_function def matches?(_exists, value, condition) unless condition.is_a?(Array) raise Errors::InvalidQuery, "$in argument must be an array: #{Errors::InvalidQuery.truncate_expr(condition)}" end if value.is_a?(Array) && value.any? do |v| condition.any? do |c| EqImplWithRegexp.matches?('$in', v, c) end end return true end condition.any? do |c| EqImplWithRegexp.matches?('$in', value, c) end end |