From 29fe91901a188af552a0bbaeb59eaf056fbe385d Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Fri, 25 Oct 2024 11:34:27 +1100 Subject: Remove equality checks due to infinite loop --- lib/person.rb | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'lib/person.rb') diff --git a/lib/person.rb b/lib/person.rb index 9a3dcb6..0b8c634 100644 --- a/lib/person.rb +++ b/lib/person.rb @@ -17,29 +17,6 @@ class Person @spouse = spouse end - # Checks equality with another object. - # - # @param other [Object] The object to compare with. - # @return [Boolean] True if the other object is a Person with the same name, gender, and spouse, false otherwise. - def ==(other) - other.is_a?(Person) && name == other.name && gender == other.gender && spouse == other.spouse - end - - # Checks equality with another object (alias for ==). - # - # @param other [Object] The object to compare with. - # @return [Boolean] True if the other object is a Person with the same name, gender, and spouse, false otherwise. - def eql?(other) - self == other - end - - # Computes the hash code for the Person object. - # - # @return [Integer] The hash code based on the name, gender, and spouse. - def hash - [name, gender, spouse].hash - end - # Returns a string representation of the Person. # # @return [String] The string representation in the format "name (gender)". -- cgit v1.2.3