Maybe somebody can help me.
Starting with a CSV file like so:
Ticker,\"Price\",\"Market Cap\" ZUMZ,30.00,933.90 XTEX,16.02,811.57 AAC,9.83,80.02
Not as 1-liner-ie but this was more clear to me.
csv_headers = CSV.parse(STDIN.gets) csv = CSV.new(STDIN) kick_list = [] csv.each_with_index do |row, i| row_hash = {} row.each_with_index do |field, j| row_hash[csv_headers[0][j]] = field end kick_list << row_hash end