Hi all,

I have a hash containing multiple key/values. I want to wirte all
key/value to the same row using cvs library. Is it possible to do that?
Now I follow the example from the library and I can only write each
key/value to one row and multiple rows from a hash.

Thanks,

Li

##########
EXAMPLE

  Write rows to 'csvout' file.

  outfile = File.open('csvout', 'wb')
  CSV::Writer.generate(outfile) do |csv|
    csv << ['c1', nil, '', '"', "\r\n", 'c2']

    ####here is my modified code###
    hash.each_pair{|k,v|csv<<"#{k}","#{v}"}

    ...
  end

  outfile.close
############
-- 
Posted via http://www.ruby-forum.com/.