Have you ever combined heredocs with format strings:
<<TEMPLATE % [23, 42]
First value: %s
Second value: %s
TEMPLATE
Unusual to have the substitutions in the beginning, but I kind of like it 🤔
Format string docs: https://idiosyncratic-ruby.com/49-what-the-format.html