I have a string in Ruby:
The animal_name is located in the some_place
How do I replace animal_name by "fish" and some_place by "lake"
I've used sentence.sub! 'animal_name', 'fish' which works great for one word but I'm only allowed 2 parameters therefore I can't change different kinds of words at the same time.
I want to do something like:
sentence.sub! ('animal_name' => 'fish', 'some_place' => 'lake')
Any ideas on how to do that ?
gsubwith a hash is the normal way one would perform the desired substitutions.