Created
July 14, 2014 19:20
-
-
Save hannestyden/121a4061bc800a998f48 to your computer and use it in GitHub Desktop.
This file contains 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
class Fixnum | |
def +@ | |
2 | |
end | |
def -@ # !> method redefined; discarding old -@ | |
-2 | |
end | |
def +(o) # !> method redefined; discarding old + | |
3 | |
end | |
def -(o) # !> method redefined; discarding old - | |
-3 | |
end | |
end | |
0 - 1 # => -3 | |
- 1 # => -2 | |
-1 # => -1 | |
+1 # => 1 | |
+ 1 # => 2 | |
0 + 1 # => 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment