Hi -- On Sat, 12 May 2007, Rick DeNatale wrote: > On 5/11/07, dblack / wobblini.net <dblack / wobblini.net> wrote: >> Hi -- >> >> On Sat, 12 May 2007, Rick DeNatale wrote: > >> > >> > Not exactly the same thing though, if you don't know that the obj >> > isn't already an array then there's no guarantee that >> > >> > [obj] == obj.to_a >> > >> > obj = 1 >> > [obj] #=> [1] >> > >> > obj = %{already an array} >> > [obj] #=> [['already', 'an', 'array']] > >> >> I think that the * operator will (always?) do it: >> >> [*1] # => [1] >> [obj] # => ["already", "an", "array"] > > Yep, as long as you actually USE it <G> > irb(main):001:0> obj = %w{already an array} > => ["already", "an", "array"] > irb(main):002:0> [*obj] > => ["already", "an", "array"] Whoops :-) > I'm not sure whether or not the to_splat changes in Ruby 1.9 will have > a subtle effect on this though. I thought that was considered just an experiment... and I admit I had sort of hoped that was the case. But if it does remain, it will definitely make my answer obsolete. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)