parent = ["A","B","C",["a","b", "c", "d"], "D"]
parent.each do |children|
if children.is_a?
children.flatten # how do i insert it back to parent
# so that this loop can continue looping through the remainder
#including the newly flattened children(a,b,c,d)
end
end
The question is, once an array is discovered, i flatten it, and need it to be inserted it to the original parent array, so that A,B,C,a,b,c,d,D will be looped once.
From the description it seems that you would be able to do