Currently I can get all permutations of a two item array as such:
[[:a, :b], [:c, :d]].reduce(&:product)
# => [[:a, :c], [:a, :d], [:b, :c], [:b, :d]]
However when I try and do the same for a three item array I do not get the desired result:
[[:a, :b], [:c, :d], [:e, :f]].reduce(&:product)
# => [[[:a, :c], :e], [[:a, :c], :f], [[:a, :d], :e], [[:a, :d], :f]]
The expected result is:
[[:a, :c, :e], [:a, :c, :f], [:a, :d, :e], [:a, :d, :f] ...]