Last active
July 25, 2017 17:40
-
-
Save drbrain/e4ab170a9ac31d88f3ab to your computer and use it in GitHub Desktop.
A method that has a default argument that defines a method that contains a here-document
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
def a l = def b; <<-NIGHTMARES; end; puts send l; end | |
😱😱😱 | |
NIGHTMARES | |
a |
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
$ ruby nightmares.rb | |
😱😱😱 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd forgotten, btw, that
def
returns a value. Thanks for the reminder.