Heredoc + Method

If you have some data that you want to embed into your program you may want to use a “heredoc”.

Like this:

1 2 3 4 5 input = <<-IN ULL RRDDD LURDL IN

This will give you a string. But you may want to do some post-processing, like splitting this string into an array of strings.

Ruby lets you do this:

1 2 3 4 5 input = <<-IN . split ULL RRDDD LURDL IN