Hash is to large ruby terminate ram!

I hope this link is not in breach of user agreement…

This has become a exciting challenge…
I’m trying generate a hash or array that match’s the patter of the
output you see.(from the link above)

This is the best working example so far. I have been working on this for
a few weeks now.

deep=10

You will see the first element of each hash is 10 in length

Then the second element starts from a single character and will
progress.

If I increase deep=20 Then system becomes unstable and ruby terminates.
not enough ram.

I hope to increase deep to much higher…
i dont need to store this hash in memory, i hope to block threw this
data…
I appreciate any help you guys can provide.

It seems holding such big arrays (10,485,760 elements for deep=20) in
memory is not necessary for the task. Just rewrite it to use just
enumerators whenever possible and perform operations on-the-fly.