I have varying number of arrays within one giant array. (is this the right approach?)
parentArray = [[array],[array2],....]
how can i create a series of nested loops for each consecutive array ? So creating array loops within the previous one.
parentArray.each do |eacharray|
array.each do |eacharray1|
array2.each do |eacharray2|
array3.each do |eacharray3|
arrayN.each do ....
.....
.....
...
...
end
end
end
end
@Justice, basically i have many arrays. the first array is the "parent", then the next array is the children of each value's of "parent". if there is another array, then it will be the children of each value of immediate previous array.
EXample:
A spider will visit the first page containing links, and store this as array. spide visits first link on the first page, and discovers lot more links at this level, and stores this as array. Spider keeps going and keeps discovering more and more links until it goes to the deepest level.
I end up with
rootArray = [arrayLinks, arrayLink2, arrayLinks3....]
simply doing .flatten will destroy all depth relationship.
what is required is recursive (tree?) routine that will do a recursive nested loop starting with the very first array (aka arrayLinks), and building another loop inside the first, and so on.