Reputation: 7728
I wanted to reduce a multi-dimensional array into a smaller multi-dimensional array. Let me post what I mean. Here is my input/starting array:
[
[
[ ["Armando", "P"], ["Dave", "S"] ],
[ ["Richard", "R"], ["Michael", "S"] ],
],
[
[ ["Allen", "S"], ["Omer", "P"] ],
[ ["David E.", "R"], ["Richard X.", "P"] ]
]
]
And I think this is the four dimensional array which I want to reduce to:
["Armando", "P"], ["Dave", "S"], ["Richard", "R"], ["Michael", "S"], ["Allen", "S"],["Omer", "P"] , ["David E.", "R"], ["Richard X.", "P"]
How can I do this in Ruby?
Upvotes: 2
Views: 513