From: Florian Frank Date: 2006-11-21T19:31:42+09:00 Subject: Re: array question Li Chen schrieb: > I want to build a new array from an old one with every element being > duplicated except the first and last element. And here are my codes. I > wonder if this is a real Ruby way to do it. > c = a.size > 2 ? a[0, 1] + a[1..-2].inject([]) { |b,x| b << x << (x.dup rescue x) } + a[-1, 1] : a