R
Roger Pack
Question: is it possible to create an array of here documents?
a = [<<END
some stuff
more stuff
END,
<<END
even more
END
]
?
a = [<<END
some stuff
more stuff
END,
<<END
even more
END
]
?
Question: is it possible to create an array of here documents?
Question: is it possible to create an array of here documents?
a = [<<END
some stuff
more stuff
END,
<<END
even more
END
]
?
Question: is it possible to create an array of here documents?
stuff = [ <<DOC1, <<DOC2, <<DOC3 ]
Hello World
DOC1
How's it going?
DOC2
It's just crazy, thanks.
DOC3
p stuff
#=> ["Hello World\n", "How's it going?\n", "It's just crazy, thanks.
\n"]
Question: is it possible to create an array of here documents?
stuff = [ <<DOC1, <<DOC2, <<DOC3 ]
Hello World
DOC1
How's it going?
DOC2
It's just crazy, thanks.
DOC3
Yup:Question: is it possible to create an array of here documents?
a = [<<END
some stuff
more stuff
END,
<<END
even more
END
]
?
a = [<<FOO, <<BAR]
some stuff
more stuff
FOO
even more
BAR
Is there any reason you wouldn't set up the heredocs first and then add
them to an array?
HD1 = <<ENDHD1
This is a heredoc.
The first of 2.
ENDHD1
HD2 = <<ENDHD2
This is the second heredoc.
ie the last.
ENDHD2
a=[HD1,HD2]
Question: is it possible to create an array of here documents?
a = [<<END
some stuff
more stuff
END,
<<END
even more
END
]
?
Yup:
a = [<<FOO, <<BAR]
some stuff
more stuff
FOO
even more
BAR
Is there any reason you wouldn't set up the heredocs first and then
add
them to an array?
HD1 = <<ENDHD1
This is a heredoc.
The first of 2.
ENDHD1
HD2 = <<ENDHD2
This is the second heredoc.
ie the last.
ENDHD2
a=[HD1,HD2]
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.