From: Stefan Salewski Date: 2011-02-24T07:11:41+09:00 Subject: Re: a, b = Array.new(2).map!{|x| data.dup} On Thu, 2011-02-24 at 06:58 +0900, Brian Candler wrote: Stefan Salewski wrote in post #983432: > > > > Is there a nicer variant available? > > # here's one > @scr, @png, @pdf, @svg, @ps = Array.new(5) { @output.dup } > > # here's another, not for <=1.8.6 > @scr, @png, @pdf, @svg, @ps = 5.times.map { @output.dup } > > But I think the original 5 lines is clearer :-) > > Thanks. I agree, but I am still learning Ruby, so I like to see what is possible. And I like to save some lines of code. On the other hand, plain code is easier to understand and can easier converted to other languages, I know.