Assuming your data is in a file named ‘list.txt’, here’s a crude but effective way to do it.
*# initialize your result to an empty hash
result_hash = Hash.new
read in your data one line at a time
File.open(‘list.txt’).each do |line|
# break the line on commas, less the last (\n) character into fields
split_line = line[0…line.length-2].split(‘,’)
# use the first field, less the quotes, as the key
key = split_line[0].gsub(/"/,‘’)
# use the remaining fields, joined with commas, less the quotes as the value
value = split_line[1…split_line.length-1].join(‘,’).gsub(/"/,‘’)
# merge into your result_hash
result_hash.merge!({key => value})
end*