I\'m looking for a better way to merge variables into a string, in Ruby.
For example if the string is something like:
\"The animal action<
The standard ERB templating system may work for your scenario.
def merge_into_string(animal, second_animal, action)
template = 'The <%=animal%> <%=action%> the <%=second_animal%>'
ERB.new(template).result(binding)
end
merge_into_string('tiger', 'deer', 'eats')
=> "The tiger eats the deer"
merge_into_string('bird', 'worm', 'finds')
=> "The bird finds the worm"