CSV is a part of the ruby stdlib, have a look here: http://ruby-doc.org/stdlib-2.0.0/libdoc/csv/rdoc/CSV.html
You can set it up to take a dictionary per line and return CSV. Check it out.