Created
February 25, 2014 01:31
-
-
Save spickermann/9200851 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
class Foo | |
def initialize(foo) | |
@foo = foo | |
end | |
def foo | |
@foo | |
end | |
def -@ # This is awesome | |
Foo(-foo) | |
end | |
end | |
def Foo(foo) | |
Foo.new(foo) | |
end | |
puts Foo(5).foo # => 5 | |
puts Foo(-5).foo # => -5 | |
puts -Foo(5).foo # => -5 (what is awesome) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment