Indentation in templates?

Hi all,

Given the code below …

templateHelloWorld = <<EOF
Hello
World!
EOF

templateMain = <<EOF
blabla
#{templateHelloWorld}
more blabla
EOF

puts templateMain

… the output is …

blabla
Hello
World!
moreblabla

… as we would expect. Would it be possible somehow to “remember” or
“know” that templateHelloWorld is being indented and apply that same
indentation to every line output by it? So the output would be

blabla
Hello
World!
moreblabla

instead?

Just wondering if something like that might be possible.

Cheers,
Hilco

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs