Sha256: 8c6cb4e024f1e913d41ff9a98f159a022a9965a9b47e4ff7dc940e8b4ea48641

Contents?: true

Size: 433 Bytes

Versions: 5

Compression:

Stored size: 433 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Matchers #:nodoc:
    class Default
      # Creating a new matcher only requires the value.
      def initialize(attribute)
        @attribute = attribute
      end
      # Return true if the attribute and value are equal.
      def matches?(value)
        @attribute == value
      end

      protected
      def first(value)
        value.values.first
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongoid-1.1.4 lib/mongoid/matchers/default.rb
mongoid-1.1.3 lib/mongoid/matchers/default.rb
mongoid-1.1.2 lib/mongoid/matchers/default.rb
mongoid-1.1.1 lib/mongoid/matchers/default.rb
mongoid-1.1.0 lib/mongoid/matchers/default.rb