Created
July 4, 2018 11:32
-
-
Save yancya/f1f1fa747f16c166db06c3332153b3e7 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 Array | |
def +@ | |
false | |
end | |
end | |
class TrueClass | |
def +(o) | |
to_s + o.join(',') | |
end | |
end | |
class FalseClass | |
def +(o) | |
to_s + o.join(',') | |
end | |
end | |
class String | |
def +(o) | |
[self, o.to_s].join | |
end | |
end | |
p !+[] #=> true | |
p !+[]+[] #=> "true" | |
p !+[]+[]+![] #=> "truefalse" | |
p (!+[]+[]+![]).length #=> 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment