-
-
Save banister/067606a7e5f36dbe505c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Equality---At the Object level, == returns | |
true only if obj and other are the | |
same object. Typically, this method is overridden in descendant | |
classes to provide class-specific meaning. | |
Unlike ==, the equal? method should never be | |
overridden by subclasses: it is used to determine object identity | |
(that is, a.equal?(b) iff a is the same | |
object as b). | |
The eql? method returns true if | |
obj and anObject have the same value. Used by | |
Hash to test members for equality. For objects of | |
class Object, eql? is synonymous with | |
==. Subclasses normally continue this tradition, but | |
there are exceptions. Numeric types, for example, | |
perform type conversion across ==, but not across | |
eql?, so: | |
1 == 1.0 #=> true | |
1.eql? 1.0 #=> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment