Unindent HEREDOCs in Ruby 2.3

Posted Over 8 years ago. Visible to the public.

In Ruby 2.3 you can use <<~ instead of <<- to automatically remove indentation from a HEREDOCs:

str = <<~MESSAGE
  Hello Universe!
  This is me.
             Bye!
MESSAGE

str will now be:

Hello Universe!
This is me.
           Bye!
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2015-12-22 18:28)