Module: Domain::Equalizer::Methods
- Defined in:
- lib/domain/support/equalizer.rb
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Compare the object with other object for equivalency.
-
#hash ⇒ Object
Returns a hash code for the value.
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Compare the object with other object for equivalency
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 |
#hash ⇒ Object
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 |