From: Robert Klemme Date: 2010-04-22T01:20:06+09:00 Subject: Re: Function accepting argument list or array On 04/21/2010 05:52 PM, Jesús Gabriel y Galán wrote: > although be careful, this will flatten nested arrays all along (don't > know if this is good or bad for you): > > irb(main):025:0> method [[1,2],[3,4]] > [1, 2, 3, 4] You can control that at least in 1.8.7 and 1.9.*: irb(main):001:0> a=[[[1,2],3],4] => [[[1, 2], 3], 4] irb(main):002:0> a.flatten => [1, 2, 3, 4] irb(main):003:0> a.flatten 1 => [[1, 2], 3, 4] irb(main):004:0> Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/