is there a way to iterate through that first array to produce the output
I want using flatten?
Do you want a general solution that will always reduce things down the
the
inner-most array? And is there no limit to how many levels deep those
inner-most arrays will be? If so, you’d probably need a recursive
function
call.
Note that if all the inner-most arrays have exactly two elements, you
can
use:
my_array.flatten.each_slice(2).to_a
(the .to_a is to collapse the Enumerator back to actual data; not really
necessary most of the time)