Sha256: 2d0f3f18958ba17e24880afe3dfce261b25df959efe79d38e6c4f592a1a534c4

Contents?: true

Size: 611 Bytes

Versions: 13

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

module Mongoid
  module Matchable

    # Performs not in checking.
    class Nin < Default

      # Return true if the attribute is not in the value list.
      #
      # @example Do the values match?
      #   matcher._matches?({ :key => 10 })
      #
      # @param [ Hash ] value The values to check.
      #
      # @return [ true, false ] If a value exists.
      def _matches?(value)
        attribute_array = @attribute.nil? ? [nil] : Array.wrap(@attribute)
        attribute_array.none? { |e| value.values.first.include?(e) }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
mongoid-7.1.11 lib/mongoid/matchable/nin.rb
mongoid-7.1.10 lib/mongoid/matchable/nin.rb
mongoid-7.1.9 lib/mongoid/matchable/nin.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/lib/mongoid/matchable/nin.rb
mongoid-7.1.8 lib/mongoid/matchable/nin.rb
mongoid-7.1.7 lib/mongoid/matchable/nin.rb
mongoid-7.1.6 lib/mongoid/matchable/nin.rb
mongoid-7.1.5 lib/mongoid/matchable/nin.rb
mongoid-7.1.4 lib/mongoid/matchable/nin.rb
mongoid-7.1.2 lib/mongoid/matchable/nin.rb
mongoid-7.1.1 lib/mongoid/matchable/nin.rb
mongoid-7.1.0 lib/mongoid/matchable/nin.rb
mongoid-7.1.0.rc0 lib/mongoid/matchable/nin.rb