OMGCSV

OMGCSV is a tiny layer that sits between Hiroshi Nakamura's CSV library (included in ruby) and your application. It provides index and key-based access to CSV data, and fakes out accessors too.

It currently provides all data as strings.

E.g. Given the the data file food.csv with the following contents:

name,goes with mustard,score
donut,false,20
hotdog,true,15

You can use the following code:

require 'rubygems'
require 'omgcsv'

data = OMGCSV::read('food.csv')
donut,hotdog = data[0],data[1] # rows by index
donuts_are_better = donut[2].to_i > hotdog[:score].to_i # cells by index/ key
donuts_go_with_mustard = donut[:'goes with mustard'] == 'true'
str = "#{donut.name}s taste better than #{hotdog.name}s," + # attributes
    (donuts_go_with_mustard ? " and they're delicious with mustard!" : 
    " but don't try them with mustard.")
puts str

To output:

donuts taste better than hotdogs, but don't try them with mustard. 

In addition:

donut === ['donut', 'false', '20']

evaluates to true.

For more, see the spec.