From: Trans Date: 2008-09-30T12:28:39+09:00 Subject: Re: Way to intercept method calls? - Reopened On Sep 29, 11:22 pm, Jens Wille wrote: > hi brian! > > this is what i have come up with so far: > > > > unfortunately, it doesn't work as intended yet ;-) the open issues > being: > > 1) there doesn't seem to be a way to cancel the original method > invocation from Kernel#set_trace_func > > > > 2) local variables in the method body are indistinguishable from > method arguments when using Kernel#local_variables > > > > 3) [MINOR] maybe it should also apply down the inheritance chain > (replace 'klass.equal?(base)' with 'klass <= base')? > > > > does anybody have an idea as to how to address these issues (1 + 2)? > or is this approach (Kernel#set_trace_func) rather silly and hopeless? It's only worth it for things like debugging. It's way to slow to be generally useful. You can look at Facets' tracepoint.rb library, to see another variation on a set_trace_func wrapper. trans.