Sha256: 8fd37cd8376ca2ccde8685905817c2d6e769748a6c1c4a107e455cc129ee54ed

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/hash_with_indifferent_access'

module MemoryModel
  class Base
    module Operations
      module Comparisons

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

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

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

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
memory_model-1.0.0 lib/memory_model/base/operations/comparisons.rb
memory_model-0.1.0 lib/memory_model/base/operations/comparisons.rb