Trans
9/13/2007 7:25:00 PM
On Sep 13, 11:06 am, "ara.t.howard" <ara.t.how...@gmail.com> wrote:
> On Sep 13, 2007, at 11:35 AM, Trans wrote:
>
> > I like this library. But I'm curious, why not just stick with the
> > "Fieldarray" class and add an Array#to_fa method, instead of dealing
> > with overriding/singleton methods on Array at all?
>
> the primary/initial use was this:
>
> result = database_connection.execute 'select * from foobar'
>
> fields = result.fields #=> postgres and other adapters
> give this info
> ten_thousand_records = result.records #=> but then return and array
> of arrays
>
> # so...
>
> ten_thousand_records.each do |record|
> record.fields = fields
> end
>
> # instead of creating ten thousand new objects we just work with what
> we've got
>
> csv (before faster csv) is another use case.
>
> basically alot of libs give back arrays for order, but then code
> reads like
>
> wtf = row[7]
>
> instead of
>
> p row[:ssn]
>
> hopefully that's clear enough ?
yep.
T.