In my Ruby on Rails app, I have a method in my helper which opened a file by:
content = File.open(myfile.txt)
The cont
line.gsub!(/my/, "her")
Although you may want to get more specific with the regular expression, e.g.
line.gsub!(/\bmy\./, "her")