Sha256: a686862100fa49da54910de28b5893d8a74e843e1fc59cc49e292317ced2afcf

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
sepastian-mongoid-rails4-4.0.1.alpha lib/mongoid/matchable/nin.rb
sepastian-mongoid-rails4-4.0.0.alpha lib/mongoid/matchable/nin.rb
mongoid_heroku_stable-4.0.0 lib/mongoid/matchable/nin.rb
mongoid_rails4-4.0.0 lib/mongoid/matchable/nin.rb