Module: TTY::Equatable::Methods
- Defined in:
- lib/tty/support/equatable.rb
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.
144 145 146 147 |
# File 'lib/tty/support/equatable.rb', line 144 def ==(other) return false unless self.class <=> 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.
131 132 133 |
# File 'lib/tty/support/equatable.rb', line 131 def eql?(other) instance_of?(other.class) and compare?(__method__, other) end |