G
Gavin Sinclair
Is the syntax error because of the first line or because of the second?
I ask because I do this a lot in my code:
s = "this is a string " \
"that I have chosen to break " \
"into multiple lines
I would be happy to switch to using heredocs if there were an easy way
to indent heredocs.
require 'extensions/all' # http://extensions.rubyforge.org
s = %{
| this is a string
| that I have chosen to break
| into multiple lines
}.trim('|')
# or
s = %{
this is a string
that I have chosen to break
into multiple lines
}.trim.tabto(0)
That would produce a three-line string, unlike your example, but you
mention indenting heredocs, so there you go.
Cheers,
Gavin