James Gray
2/7/2007 2:05:00 PM
On Feb 6, 2007, at 2:42 PM, ara.t.howard@noaa.gov wrote:
> On Wed, 7 Feb 2007, James Edward Gray II wrote:
>
>> On Feb 6, 2007, at 1:57 PM, ara.t.howard@noaa.gov wrote:
>>
>>> On Wed, 7 Feb 2007, James Edward Gray II wrote:
>>>> FCSV.read(csv_filename, :headers => true, :converters => :numeric)
>>> alias to FCSV.table
>>> perhaps?
>>
>> Alias read() to table() or read() with those options?
>
> the latter. i hate typing! ;-)
>
> actually, read with those __default__ options. so
>
> def FCSV.table opts = {}
>
> ....
>
> headers = opts[:headers] || opts['headers'] || true
> converters = opts[:converters] || opts['converters']
> || :converters
>
> ....
>
> end
>
>
> thoughts??
Yes, FasterCSV doesn't support goofy Rails-like Hashes. :D
Beyond that though, I released FasterCSV 1.2.0 today with the
addition of:
def self.table(path, options = Hash.new)
read( path, { :headers => true,
:converters => :numeric,
:header_converters => :symbol }.merge(options) )
end
Enjoy.
James Edward Gray II