From: Robert Klemme Date: 2012-07-04T02:26:13+09:00 Subject: Re: Using binding + set trace func to capture execution state On Tue, Jul 3, 2012 at 7:13 PM, Reginald Tan wrote: >> >> What about debug output? You can make that pretty efficient: >> >> if ENV["DEBUG"] >> def debug; $stderr.puts(yield) end >> else >> def debug; end >> end >> >> debug { sleep 1; "Complex operation" } > Hi Robert, I'm not sure I understand what you mean. Isn't that the same > as just inserting a puts statement in the code or putting logger debug > statements around the code? Sort of, just a tad smarter. > What I wish to do is to inspect the > variables at any line of execution without modifying the original > program :) Oh, that requirement wasn't given as far as I can see. That's something different of course. Why would the debugger not work for you? If you know the line (as you said earlier) you can use that information to set a breakpoint and inspect data when you've hit the breakpoint. Can you explain what goal you are trying to achieve? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/