Module: MongoMapper::Plugins::Equality::InstanceMethods

Defined in:
lib/mongo_mapper/plugins/equality.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



6
7
8
# File 'lib/mongo_mapper/plugins/equality.rb', line 6

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

#eql?(other) ⇒ Boolean

Returns:



10
11
12
# File 'lib/mongo_mapper/plugins/equality.rb', line 10

def eql?(other)
  self == other
end

#equal?(other) ⇒ Boolean

Returns:



14
15
16
# File 'lib/mongo_mapper/plugins/equality.rb', line 14

def equal?(other)
  object_id === other.object_id
end

#hashObject



18
19
20
# File 'lib/mongo_mapper/plugins/equality.rb', line 18

def hash
  _id.hash
end