From: Robert Klemme Date: 2010-06-01T04:16:12+09:00 Subject: Re: Ruby breakpoint has weird idea of what local_variables are? 2010/5/31 RichardOnRails : > Hi, > > I've got a 7-liner: > require 'rubygems' > require 'breakpoint' > > a = 'aaa' > b = 'bbb' > breakpoint > c = 'ccc' > > In a Command window, I've got: > K:\_Projects\Ruby\_Ruby_Tests\TestBreakpoint>ruby TestBreakpoint.rb > Executing break point at TestBreakpoint.rb:9 > irb(main):001:0> local_variables > => ["id", "block", "_"] > irb(main):002:0> quit > > This test is based on Recipe 17.10 of the Ruby Cookbook, O'Reilly, > 2006 > > Why doesn't the array allegedly presenting local variables: > 1. Include a, b & c? > 2. Present the things it does; what do they signify? > > I'm running Ruby 1.8.6 over WinXP-Pro/SP3 No idea. However, the "regular" debugger does not have that issue: Robert@babelfish ~ $ ruby19 -r debug x.rb Debug.rb Emacs support available. x.rb:1:a = 'aaa' (rdb:1) l [-4, 5] in x.rb => 1 a = 'aaa' 2 b = 'bbb' 3 # breakpoint 4 c = 'ccc' (rdb:1) b 4 Set breakpoint 1 at x.rb:4 (rdb:1) v l a => nil b => nil c => nil (rdb:1) c Breakpoint 1, toplevel at x.rb:4 x.rb:4:c = 'ccc' (rdb:1) v l a => "aaa" b => "bbb" c => nil (rdb:1) n Robert@babelfish ~ $ Note: "v l" lists local variables. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/