Skip to content

Instantly share code, notes, and snippets.

@hannestyden
Created July 14, 2014 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hannestyden/121a4061bc800a998f48 to your computer and use it in GitHub Desktop.
Save hannestyden/121a4061bc800a998f48 to your computer and use it in GitHub Desktop.
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