@jared You didn't give us a tricky case where it didn't interpolate, and you got hideous mis-syntax?
That's wonderfully hideous, though.
I use multiple heredocs in a single line routinely to put test-app code and test code together. But never nested heredocs. Guess it's time to find a use for them! 😈
I'm glad you posted it on Mastodon too @jared! There's enough room for me to explain my reasoning here.
Based on the docs (https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-Here+Document+Literals) and some experimentation, I think it's this.
PLEASE is opened and closed within OH_NO.
`concat` executes at the end of OH_NO and opens JARED_STOP.
That leaves the first and last line only in DO_CRIME.
But do you know the actual answer or how to find it?
@ChaelCodes Yes, you have it right! 💪
Here's a version where I've added annotations to make it more clear, the output… and then an image I just made that shows the same thing yours does.
I admittedly hadn't tried to figure out what was going on until you asked. I think the right way would probably be to run it through RubyConf doublRubyConf
Credit Kevin Newton for the idea. I overheard him talking about an issue with nested heredocs at lunch at RubyConf and I couldn't help myself.
✨ Magical! ✨