From: Rolf Pedersen Date: 2010-04-25T07:35:21+09:00 Subject: Re: Metaprogramming - Array initialization --0016361e83e68e3ae90485032816 Content-Type: text/plain; charset=ISO-8859-1 A subtle improvement to the function, as I failed to remember that I could expand an array to multiple arguments again when calling the function recursively: def make_array(*a) if a.size > 1 Array.new(a.shift){make_array(*a)} elsif a.size == 1 Array.new(a.shift) end end -Rolf On Sun, Apr 25, 2010 at 12:19 AM, Paul A. wrote: > Very instructives and helpful answers. Many thanks! > -- > Posted via http://www.ruby-forum.com/. > > --0016361e83e68e3ae90485032816--