Sha256: 699bf7869f75765c83f16bdb81496dbb6859dd648d036120f8a99dde061b6e50

Contents?: true

Size: 378 Bytes

Versions: 20

Compression:

Stored size: 378 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    module Equality
      extend ActiveSupport::Concern

      module ClassMethods
        def ===(other)
          other.is_a?(self)
        end
      end

      def eql?(other)
        other.is_a?(self.class) && _id == other._id
      end
      alias :== :eql?

      def hash
        _id.hash
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
mongo_mapper-0.16.0 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.6 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.5 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.4 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.3 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.2 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.15.0 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.14.0 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.13.1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.13.0 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.13.0.beta2 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.13.0.beta1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.12.0 lib/mongo_mapper/plugins/equality.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.11.2 lib/mongo_mapper/plugins/equality.rb
jamieorc-mongo_mapper-0.11.1.1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.11.1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.11.0 lib/mongo_mapper/plugins/equality.rb