I have a tree that I am trying to go through. When I cross it, I save an enumeration stack in which each enumerator is used to enumerate over the children of the tree.
I would like to be able to duplicate this stack of enums and pass it to another object so that it can traverse the tree starting at the location indicated by the state of the stack.
When I try to call #dup on an Enumerator, I get an error. Can I duplicate a counter? If not, how could I do the same? (I considered the stack of integers as indices, but I'm worried about efficiency.
Here is some code to show what I see ...
Once the first counter is running, you cannot duplicate it. This is my situation.
a = [1,2,3].each =>
source share