On Mon, 31 Oct 2005, James Edward Gray II wrote:

> I've decided to create a FasterCSV library, based on the code we worked out 
> in this thread.  I'm playing with some different options and would like to 
> hear opinions.  Would you rather I:
>
> 1.  Add a CSV::fast_parse() to the current CSV library in an attempt to dodge 
> compatibility issues.
> 2.  Try to make FasterCSV API compatible with CSV, so your just change your 
> require statement if you want to switch over.
> 3.  Make FasterCSV an all new library for parsing CSV.  This might give us 
> some fun options, like a "header" option to treat the first as headers and 
> then allow you to access fields in the rows by name.

3 please!  i have this in almost ALL my code:

   require 'csv'
   require 'arrayfields'

   class SomeTable < ::Array
     def initialize path
       header = nil
       CSV::parse(path) do |row|
         header ||= row
         self << row
       end
       self.fields = fields
     end
   end

and whammo - keywords access to cells.  it make using csv infinitely easier.

regards.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| anything that contradicts experience and logic should be abandoned.
| -- h.h. the 14th dalai lama
===============================================================================