Read more

Unindent HEREDOCs in Ruby 2.3

Henning Koch
December 22, 2015Software engineer at makandra GmbH

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
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

str will now be:

Hello Universe!
This is me.
           Bye!
Posted by Henning Koch to makandra dev (2015-12-22 19:28)