From: dblack@... Date: 2006-10-24T23:52:56+09:00 Subject: Re: '**' as hash splat? Hi -- On Tue, 24 Oct 2006, Kalman Noel wrote: > Ken Bloom: >> On Mon, 23 Oct 2006 20:49:55 -0700, Trans wrote: >>> a = [2,1] >>> [3,*a] #=> [3,2,1] >> The purpose of splat is to convert an array into a list of parameters to a >> method. Since [] is a method, > > irb> method :[] > NameError: undefined method `[]' for class `Object' irb(main):003:0> a = [2,1] => [2, 1] irb(main):004:0> [3, *a] => [3, 2, 1] David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org