From: Gavin Kistner Date: 2005-08-04T08:39:01+09:00 Subject: Re: Combination of two arrays On Jul 28, 2005, at 8:09 AM, Jim Freeze wrote: > irb(main):004:0> foo.collect { |f| f * bar }.inject([]) { |a,e| > a.concat e } > => [["a", 1], ["a", 2], ["a", 3], ["b", 1], ["b", 2], ["b", 3], > ["c", 1], > ["c", 2], ["c", 3]] > > There, that's better, but ugly. Anyone got a cleaner way to flatten? require 'flattenx' foo.collect { |f| f * bar }.flatten_once (Given http://www.wobblini.net/ruby/flattenx.html )