Sha256: 4b19a5b6fdea0f7c25dea72faba2c4a3f3959491d19bae48c1a7bf41ebbbde4e

Contents?: true

Size: 509 Bytes

Versions: 17

Compression:

Stored size: 509 Bytes

Contents

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

    # Performs matching for any value in an array.
    class In < Default

      # Return true if the attribute is in the values.
      #
      # @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)
        value.values.first.include?(@attribute)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mongoid-2.2.6 lib/mongoid/matchers/in.rb
mongoid-2.2.5 lib/mongoid/matchers/in.rb
mongoid-2.2.4 lib/mongoid/matchers/in.rb
mongoid-2.2.3 lib/mongoid/matchers/in.rb
mongoid-2.2.2 lib/mongoid/matchers/in.rb
mongoid-2.2.1 lib/mongoid/matchers/in.rb
mongoid-2.2.0 lib/mongoid/matchers/in.rb
mongoid-2.1.9 lib/mongoid/matchers/in.rb
mongoid-2.1.8 lib/mongoid/matchers/in.rb
mongoid-2.1.7 lib/mongoid/matchers/in.rb
mongoid-2.1.6 lib/mongoid/matchers/in.rb
mongoid-2.1.5 lib/mongoid/matchers/in.rb
mongoid-2.1.4 lib/mongoid/matchers/in.rb
mongoid-2.1.3 lib/mongoid/matchers/in.rb
mongoid-2.1.2 lib/mongoid/matchers/in.rb
mongoid-2.1.1 lib/mongoid/matchers/in.rb
mongoid-2.1.0 lib/mongoid/matchers/in.rb