Storing cvs data for further manipulation using Ruby

Posted by ischnura on Stack Overflow See other posts from Stack Overflow or by ischnura
Published on 2010-05-20T21:56:22Z Indexed on 2010/05/20 22:00 UTC
Read the original article Hit count: 209

Filed under:
|
|

I am dealing with a csv file that has some customer information (email, name, address, amount, [shopping_list: item 1, item 2]).

I would like work with the data and produce some labels for printing... as well as to gather some extra information (total amounts, total items 1...)

My main concern is to find the appropriate structure to store the data in ruby for future manipulation. For now I have thought about the following possibilities:

  1. multidimensional arrays: pretty simple to build, but pretty hard to access the data in a beautiful ruby way.
  2. hashes: having the email as key, and storing the information in different hashes (one hash for name, another hash for address, another hash for shopping list...)
  3. (getting the cvs data in to a Database and working with the data from ruby??)

I would really appreciate your advice and guidance!!

© Stack Overflow or respective owner

Related posts about ruby

Related posts about csv