Sha256: 42e51ee4e34b4dafe00363d70e6527041b002140d7e2d929437fd12d2c790470

Contents?: true

Size: 527 Bytes

Versions: 171

Compression:

Stored size: 527 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Matchers #:nodoc:

    # 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)
        Array.wrap(@attribute).none? { |e| value.values.first.include?(e) }
      end
    end
  end
end

Version data entries

171 entries across 79 versions & 4 rubygems

Version Path
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/matchers/nin.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/matchers/nin.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/matchers/nin.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/matchers/nin.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/matchers/nin.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/matchers/nin.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb
classiccms-0.5.1 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/matchers/nin.rb
classiccms-0.5.1 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/matchers/nin.rb