I have used gsub previously for a regex match, but what should I call for string literals?
I want to replace pair[0] with pair[1] wherever pair[0] is found in the file.
text = File.read( fname )
@hash_old_to_new.each do
|pair|
puts "\tReplacing " + pair[0] + " with " + pair[1]
# result = text.gsub( /pair[0]/, pair[1] ) <--- this is no good
end
File.open( fname, "w" ) { |file| file << result }