Skip to content

Instantly share code, notes, and snippets.

@drbrain
Last active July 25, 2017 17:40
Show Gist options
  • Save drbrain/e4ab170a9ac31d88f3ab to your computer and use it in GitHub Desktop.
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
def a l = def b; <<-NIGHTMARES; end; puts send l; end
😱😱😱
NIGHTMARES
a
$ ruby nightmares.rb
😱😱😱
@JoshCheek
Copy link

A totem pole:

<<-'O.o'<<<<-'O_o'<<<<-'o.O'<<%>->
            \\o.O//
              O.o
             ~OvO~
              O_o
              ^_^
              o.O
         %{#{'O.o'}}%%'
              %"%
             '''''
              #"#

Smokey the bear

             8|8|8|8|8|8|8
           #################      .---------------.
        []-->_{_       _}._<--[] | Only. You. Can. |
           %{ (.)     (.) }      |     Prevent.    |
            "{  =>(O)<=  }"      |  Forest. Fires! |
             "-... C ...-" .__--` `---------------´
                  %%%
          O"""""\\~~~//""""",O
                %|%%%|%
                """ """
                ""   ""

@IdahoEv
Copy link

IdahoEv commented Oct 7, 2015

As written, the output is:

"ruby: No such file or directory -- t.rb (LoadError)"

:-)

@IdahoEv
Copy link

IdahoEv commented Oct 7, 2015

I'd forgotten, btw, that def returns a value. Thanks for the reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment