I have a bunch of template documents which I need to manipulate in
very simple ways. I’d like to be able to insert Ruby variables into
the template. Here is a very short example:
file fruit_template.txt: This is a fruit: #{fruit}.
fruit = “apple”
f = IO.read(“fruit_template.txt”)
Then somehow I’d like to end up with this string:
“This is a fruit: apple.”
This works fine of course if I construct the string in Ruby:
s = “This is a fruit: #{fruit}.”
=> “This is a fruit: apple.”