Module: Equatable::Methods
- Defined in:
- lib/equatable.rb
Overview
The equality methods
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compare two objects for equality based on their value and being a subclass of the given class.
-
#eql?(other) ⇒ Boolean
Compare two objects for equality based on their value and being an instance of the given class.
Instance Method Details
#==(other) ⇒ Boolean
Compare two objects for equality based on their value and being a subclass of the given class.
146 147 148 |
# File 'lib/equatable.rb', line 146 def ==(other) is_a?(other.class) && compare?(__method__, other) end |
#eql?(other) ⇒ Boolean
Compare two objects for equality based on their value and being an instance of the given class.
133 134 135 |
# File 'lib/equatable.rb', line 133 def eql?(other) instance_of?(other.class) && compare?(__method__, other) end |