I have fixed the error. But csv_table not showing any data .

require 'csv'

_output_file_path =
File.expand_path('output.csv',File.dirname(__FILE__))

hash = {   'A' => [ 'v', 'x', 'y' , 'z' ] ,
           'B' => [ 'm', 'n' , 'o' ] ,
           'C' => [ 'i', 'j' , 'k' , 'l', 'm', 'n' , 'o' ]
       }

headers = hash.keys
csv_row = CSV::Row.new(headers,[],true)
csv_table = CSV::Table.new([csv_row])
csv_table.delete(1)
headers.each do |col_name|
  csv_table[col_name] = hash[col_name]
end
csv_table.to_csv
# => "A,B,C\n"

What wrong I did here ?

-- 
Posted via http://www.ruby-forum.com/.