Hi !

I've searched a lot to get an answer but I can't figured it out. I wish
to trace local variables in a method. Here is an example:

def test
  a = 1
  b = 2
end

Returns:
Variable a gets the value 1 in test
Variable b gets the value 2 in test

So, I'd like this output without adding some extra stuff in my method
test. I need a callback or thing like that but I can't find it.

I'm aware of the built-in method trace_var, but unfortunately, it's all
about global variables. So, I successed to trace attribute calls,
because it is possible to define methods like this:

def attribute=(value)
  ...
end

I also successed to trace method calls.

I've seen function like set_trace_func but it's not really convenient to
deal with my particular problem. And it isn't possible to redefine the
assignment operator = on its own.

Any ideas to trace local variables ?
Thanks !
-- 
Posted via http://www.ruby-forum.com/.