Module: MemoryModel::Base::Comparable

Included in:
MemoryModel::Base
Defined in:
lib/memory_model/base/comparable.rb

Instance Method Summary collapse

Instance Method Details

#!=(other_object) ⇒ Object



8
9
10
# File 'lib/memory_model/base/comparable.rb', line 8

def !=(other_object)
  !(self == other_object)
end

#==(other_object) ⇒ Object



3
4
5
6
# File 'lib/memory_model/base/comparable.rb', line 3

def ==(other_object)
  attributes.slice(*fields.comparable) ==
    other_object.to_hash.with_indifferent_access.slice(*fields.comparable)
end

#===(other_object) ⇒ Object



12
13
14
# File 'lib/memory_model/base/comparable.rb', line 12

def ===(other_object)
  other_object.kind_of?(self.class) && self == other_object
end