Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.ruby Subject: Re: what's up with return *splat ? Date: Tue, 12 Jun 2012 23:19:40 +0200 Lines: 34 Message-ID: References: <0fae13bb-3468-4883-b855-17950bee1117@t2g2000pbl.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net AjRU006eG8JNZb9hqFcRDwt7JkAKyrngJGV8AyCyIHdAu5gUXyP9iWZWh7+kRfgB4= Cancel-Lock: sha1:0j9F61xGIfitEMWMPsTJeVjuEUU= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: <0fae13bb-3468-4883-b855-17950bee1117@t2g2000pbl.googlegroups.com> Xref: csiph.com comp.lang.ruby:6559 On 12.06.2012 20:48, Phlip wrote: > Rubies: > > Back in the Halcyon days (whatever that means) of Ruby 1.8, a function > could obey the contract "return nil, a scalar, or an array" with a > mere splat: > > return * splat > > The interpretation there is (roughly!) "splat behaves as if you had > written each argument in an array as scalars separated by commas." > > So (roughly!), you would get one of these three results: > > return nil > return scalar > return [ scalar1, scalar2, scalar3 ] > > Now that I work in Ruby 1.9, the splat don't work like that. It just > passes through an array. > > Am I using it wrong? Did splat change? If so, why? And can I use some > other 1.9-compliant trick? Can you please show the code you used for testing? Thank you. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/