Can you do a loop and here-doc, something like this:
array.each do |ele|
a=<<-TEXT
ele
some stuff
TEXT
end
Thanks
array = %w[one two many]
array.each do |ele|
a=<<-TEXT
This is some text and
this --> #{ele} <-- is the ele!
TEXT
puts a
end
results in
This is some text and
this --> one <-- is the ele!
This is some text and
this --> two <-- is the ele!
This is some text and
this --> many <-- is the ele!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With