Afficher un message
Vieux 13/09/2007, 21h25   #4
Trans
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: arrayfields-4.0.0



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.


  Réponse avec citation
 
Page generated in 0,04724 seconds with 9 queries