module Mongoid::Matcher::All
In-memory matcher for $all expression.
@see www.mongodb.com/docs/manual/reference/operator/query/all/
@api private
Public Instance Methods
matches?(exists, value, condition)
click to toggle source
Returns whether a value satisfies an $all expression.
@param [ true | false ] exists Not
used. @param [ Object
] value The value to check. @param [ Array<Object> ] condition The $all condition predicate.
@return [ true | false ] Whether the value matches.
@api private
# File lib/mongoid/matcher/all.rb, line 21 def matches?(exists, value, condition) unless Array === condition raise Errors::InvalidQuery, "$all argument must be an array: #{Errors::InvalidQuery.truncate_expr(condition)}" end !condition.empty? && condition.all? do |c| case c when ::Regexp, BSON::Regexp::Raw Regex.matches_array_or_scalar?(value, c) else EqImpl.matches?(true, value, c, '$all') end end end