Module: MemoryModel::Base::Operations::Comparisons

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

Instance Method Summary collapse

Instance Method Details

#!=(other_object) ⇒ Object



14
15
16
# File 'lib/memory_model/base/operations/comparisons.rb', line 14

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

#==(other_object) ⇒ Object



9
10
11
12
# File 'lib/memory_model/base/operations/comparisons.rb', line 9

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

#===(other_object) ⇒ Object



18
19
20
# File 'lib/memory_model/base/operations/comparisons.rb', line 18

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