I want to replace string in CSV::Table.
I could replace the string by using gsub! like this:
csv = CSV.table(@csv_file)
csv[:tag].each do |tag|
tag.gsub!('Replace1','Replace2')
tag.gsub!('Replace3','Replace4')
end
But I prefer to use gsub with method chain
csv[:tag].each do |tag|
tag = tag.gsub('Replace1','Replace2').
gsub('Replace3','Replace4')
end
Unfortunately it doesn't change the csv[:tag] strings.
How can I replace string in CSV::Table class without using gsub!?