I have the following script:
require 'CSV'
colors = ["red", "blue", "green"]
CSV.open("valid_urls.csv", "w") do |csv|
csv << colors
end
With this code, the contents of my CSV looks like this:
red,blue,green
However, what I want is this:
red
blue
green
I tried doing something like colors = ["red", "blue", "green"].join "\n" but I get a undefined methodcollect'` error.