From: Robert Klemme Date: 2006-01-09T02:43:06+09:00 Subject: Re: You want a Ruby extension? Talk to me, baby Lou Vanek wrote: > if you want to wade into the deep end, I would like a method that > would tell me about everything that is in scope when the method is called, > and classify the objects-in-scope as instance variables, class > variables, class names, global constants, local variables, module > names--whatever they might be. Symbol.all_symbols is just a tease. > > The next thing i would like to do is to be able to "unwind" the > scope by going "up" one level and perform the same symbol dump as > defined above, except with the new scope. Recurse until at top level. > Being able to filter on any particular class of object would just be > icing. > Not even sure if this is possible, but it would sure be educational. You can get quite far with set_trace_func: http://ruby-doc.org/core/classes/Kernel.html#M001978 Just store the binding on a stack for all events like "call" and remove it for "return". I'm sure with a decent C extension this will be more efficient and probably more feature rich. Kind regards robert