I am new in ruby so please forgive the noobishness.
I have a CSV with two columns. One for animal name and one for animal type. I have a hash with all the keys being
Try this:
require 'csv' h = { 'dog' => 'canine', 'cat' => 'feline', 'donkey' => 'asinine' } CSV.open("data.csv", "wb") {|csv| h.to_a.each {|elem| csv << elem} }
Will result:
1.9.2-p290:~$ cat data.csv dog,canine cat,feline donkey,asinine