Last active
November 29, 2017 05:42
-
-
Save yoggy/a3655776786dd2363b71db3a967438a2 to your computer and use it in GitHub Desktop.
Rubyではバッククォートをオーバーライドできてしまうという個人的な驚き
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
#!/usr/bin/ruby | |
def `(str) | |
'Wed Nov 29 12:34:56 JST 2017' | |
end | |
puts `date` |
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
$ date | |
Wed Nov 29 14:37:21 JST 2017 | |
$ ./overriding-backticks-test.rb | |
Wed Nov 29 12:34:56 JST 2017 | |
$ ./overriding-backticks-test.rb | |
Wed Nov 29 12:34:56 JST 2017 | |
$ ./overriding-backticks-test.rb | |
Wed Nov 29 12:34:56 JST 2017 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment