Nikolai Weibull <mailing-lists.ruby-talk / rawuncut.elitemail.org> writes:

> Lately I've been using the Kernel.returning method from Rails to write
> it as
>
> def a
>   returning ary = [] do
>     ... construct ary by adding elements to it ...
>   end
> end
>
> which works quite well, but I think that I'd rather be writing it as
>
> def a
>   Array.new do |ary|
>     ... construct ary by adding elements to it ...
>   end
> end
>
> Array.new(size){ |index| block } would have to be changed so that size
> is optional, and if not given, then this new way of creating an array
> would be used.  What do you people think?  Is this worth yet another
> RCR?,

I'd rather vote in favor of including #returning to the Ruby core.
It is a very helpful method to DRY.

>         nikolai
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org