I've got this bit of code:
presorted_csv = CSV.read 'out.csv'
presorted_csv.sort! { |a, b| a[0].to_i <=> b[0].to_i }
I'm now wanting to simply write the sorted CSV file to disk. I'd expect it to be something like:
CSV.write('new.csv', presorted_csv)
however while there's a read
method:
http://ruby-doc.org/stdlib-2.0.0/libdoc/csv/rdoc/CSV.html#method-c-read
there's no write
method!
How do I do this in 1 line of code?