From: Martin DeMello Date: 2002-11-27T23:54:02+09:00 Subject: Re: each_with_index & collect_with_index? ts wrote: >>>>>> "M" == Martin DeMello writes: > > M> module Enumerable > > I don't think that you can put it in a module, or a class. Where would I put it, then? Global is obviously out, and I can't think of any object I could attach the countstack to. Maybe an instance of a CountStack class, with Kernel methods to access the stack. > M> Another random thought: can you get at the names of the block local > M> variables? Might be possible to hack something up along the lines of a > M> hash of symbols, if so. > > #local_variables give you the name of all local variables (with block > local) but you'll have a problem (like your current implementation) when > I'll introduce threads :-)) Ah, threads :) Is there a way of writing a class so that I can have only one CountStack object per thread, but each thread has its own instance? martin