Re: [ANN] arrayfields-4.1.0
On Sep 14, 2007, at 8:56 PM, ara.t.howard wrote:
> a = [0,1,2]
> fields = ['zero', 'one', 'two']
> a.fields = fields # ONLY the Array 'a' is
> affected!
> #
> # keyword access is now allowed for many methods
> #
> p a['zero'] #=> 0
> p a['one'] #=> 1
> p a['two'] #=> 2
> p a.at('one') #=> 1
> p a.values_at('zero', 'two') #=> [0, 2]
> #
> # assigmnet is allowed
> #
> a['zero'] = 42
> p a['zero'] #=> 0
Surely, the last line above contains a typo. Shouldn't it be
> p a['zero'] #=> 42
Regards, Morton
|