Ruby multi-line string hell 1

Rich Steinmetz
Rich Steinmetz
Ruby multi-line string hell 1

Ruby developers don't usually hate things about Ruby. But there's one thing that seems to be more complicated at times than necessary in Ruby.

Here I am again, every now and then... Those purple links...

As you can see, I'm a frequent guest at some fellow sufferers' confessions.

I even blocked the deployment once, because we didn't have tests for rake tasks and CI didn't detect that this is not a multi-line string:

logger.log "A very long sentence" /
		   "that ends here"
# => NoMethodError (undefined method `/' for "A very long sentence":String)
Can you guess what other mistake is hidden here that no one of the PR reviewers will notice? 😈 

For the IDE this syntax is just fine too, so no warnings or anything there either... 💣

Basically, every time my string got too long, I needed to look it up. I think our 80 characters line length rubocop limit was just long enough to drop off my spaced learning capabilities and force me to look it up again...

So finally, I've drawn this down as a first step to get hold of the multi-line string hell.

If you try visualizing it, the forward-slash indeed makes sense in terms of flow. The text flow after the slash will go down and not up. Here it is one more time:

No more purple links! For that part at least. There's some more visualization and meditation needed to get the rest of it into my brain, so that the devious Heredoc interpolations, squiggly operators, and whitespace handlers become second nature.

Join the conversation.

Great! Check your inbox and click the link
Great! Next, complete checkout for full access to Rich Stone Input Output
Welcome back! You've successfully signed in
You've successfully subscribed to Rich Stone Input Output
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated