Module: Equalizer::Methods
- Defined in:
- lib/equalizer.rb
Overview
The comparison methods
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compare the object with other object for equivalency.
-
#eql?(other) ⇒ Boolean
Compare the object with other object for equality.
Instance Method Details
#==(other) ⇒ Boolean
Compare the object with other object for equivalency
115 116 117 118 |
# File 'lib/equalizer.rb', line 115 def ==(other) other = coerce(other) if respond_to?(:coerce, true) other.kind_of?(self.class) && cmp?(__method__, other) end |
#eql?(other) ⇒ Boolean
Compare the object with other object for equality
100 101 102 |
# File 'lib/equalizer.rb', line 100 def eql?(other) instance_of?(other.class) && cmp?(__method__, other) end |