Module: Domain::Equalizer::Methods

Defined in:
lib/domain/support/equalizer.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Compare the object with other object for equivalency

Examples:

object == other  # => true or false


45
46
47
48
# File 'lib/domain/support/equalizer.rb', line 45

def ==(other)
  return false unless self.class <=> other.class
  cmp?(__method__, other)
end

#hashObject

Returns a hash code for the value



30
31
32
# File 'lib/domain/support/equalizer.rb', line 30

def hash
  equality_components.map{|c| c.hash }.reduce(Object.hash, :^)
end