Created
September 21, 2011 06:04
-
-
Save unicornrainbow/1231365 to your computer and use it in GitHub Desktop.
==, eql?, equal?. Now we also have .eq
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
| # Use .eq where you would use ==. Avoid accidental assignment. | |
| # | |
| # if 1.eq 1 | |
| # puts "They're equal" | |
| # end | |
| # | |
| class Object | |
| def eq(operand) | |
| self == operand | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment