Sha256: 6b915ffa99f44fa36dfea66c66a2e911682133fddd6dc5968f91da9b094e1c29

Contents?: true

Size: 582 Bytes

Versions: 39

Compression:

Stored size: 582 Bytes

Contents

module Mongoid
  module Matcher

    # @api private
    module All
      module_function 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
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
mongoid-8.1.8 lib/mongoid/matcher/all.rb
mongoid-8.1.7 lib/mongoid/matcher/all.rb
mongoid-8.1.6 lib/mongoid/matcher/all.rb
mongoid-8.0.8 lib/mongoid/matcher/all.rb
mongoid-8.1.5 lib/mongoid/matcher/all.rb
mongoid-8.1.4 lib/mongoid/matcher/all.rb
mongoid-8.0.7 lib/mongoid/matcher/all.rb
mongoid-8.1.3 lib/mongoid/matcher/all.rb
mongoid-8.1.2 lib/mongoid/matcher/all.rb
mongoid-8.0.6 lib/mongoid/matcher/all.rb
mongoid-7.5.4 lib/mongoid/matcher/all.rb
mongoid-8.1.1 lib/mongoid/matcher/all.rb
mongoid-8.0.5 lib/mongoid/matcher/all.rb
mongoid-8.1.0 lib/mongoid/matcher/all.rb
mongoid-7.5.3 lib/mongoid/matcher/all.rb
mongoid-8.0.4 lib/mongoid/matcher/all.rb
mongoid-8.0.3 lib/mongoid/matcher/all.rb
mongoid-7.5.2 lib/mongoid/matcher/all.rb
mongoid-8.0.2 lib/mongoid/matcher/all.rb
mongoid-7.5.1 lib/mongoid/matcher/all.rb