Sha256: 408368fdf1acd7f16b5b7deda1994c8f6d7a4a6d7dacaa50a6d5826e083d7a27

Contents?: true

Size: 756 Bytes

Versions: 14

Compression:

Stored size: 756 Bytes

Contents

# encoding: utf-8
module Mongoid
  module Matchable

    # Defines behavior for handling $or expressions in embedded documents.
    class And < Default

      # Does the supplied query match the attribute?
      #
      # @example Does this match?
      #   matcher._matches?([ { field => value } ])
      #
      # @param [ Array ] conditions The or expression.
      #
      # @return [ true, false ] True if matches, false if not.
      #
      # @since 2.3.0
      def _matches?(conditions)
        conditions.each do |condition|
          condition.keys.each do |k|
            key = k
            value = condition[k]
            return false unless document._matches?(key => value)
          end
        end
        true
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
mongoid-6.4.8 lib/mongoid/matchable/and.rb
mongoid-6.4.7 lib/mongoid/matchable/and.rb
mongoid-6.4.5 lib/mongoid/matchable/and.rb
mongoid-6.4.4 lib/mongoid/matchable/and.rb
mongoid-6.4.2 lib/mongoid/matchable/and.rb
mongoid-6.4.1 lib/mongoid/matchable/and.rb
tdiary-5.0.8 vendor/bundle/gems/mongoid-6.4.0/lib/mongoid/matchable/and.rb
mongoid-6.4.0 lib/mongoid/matchable/and.rb
mongoid-6.3.0 lib/mongoid/matchable/and.rb
mongoid-6.2.1 lib/mongoid/matchable/and.rb
mongoid-7.0.0.beta lib/mongoid/matchable/and.rb
tdiary-5.0.5 vendor/bundle/gems/mongoid-6.2.0/lib/mongoid/matchable/and.rb
mongoid-6.2.0 lib/mongoid/matchable/and.rb
mongoid-6.1.1 lib/mongoid/matchable/and.rb