Hi,

I'm trying to remove a array layer implied by multiple Array#product

Here is the code
----------------
def calculate ranges
  prod = ranges.shift
  ranges.each { |r| prod = prod.product(r) }
  puts prod.to_s
end
---------------------------------------------
Here is what i do get
----------------------
[
  [[["a", "b"], ["e", "f"]], ["i", "j"]],
  [[["a", "b"], ["e", "f"]], ["k", "l"]],
  ...
]
-------------------------------------------
And there is what i wish
------------------------
[
  [["a", "b"], ["e", "f"], ["i", "j"]],
  [["a", "b"], ["e", "f"], ["k", "l"]],
  ...
]

Probably a silly question, but it's driving me mad.
I tried flatten, prod = prod[0], using Array#permutation, ...
Can't find my way out..???

Thanks

-- 
Posted via http://www.ruby-forum.com/.