Sha256: c33cd24a48adc229f50ec32f621791b7119a47eaef3d1dfbc36f5167038663df

Contents?: true

Size: 431 Bytes

Versions: 4

Compression:

Stored size: 431 Bytes

Contents

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

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

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

        def hash
          _id.hash
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongo_mapper-0.10.1 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.10.0 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.9.2 lib/mongo_mapper/plugins/equality.rb
mongo_mapper-0.9.1 lib/mongo_mapper/plugins/equality.rb