1. Computing

Listing Source Code

By

To list source code from the debugger, use the l command. This command will list a number of source code lines around the line currently being executed.

$ ruby -rdebug problem.rb data.txt
Debug.rb
Emacs support available.

problem.rb:3:lines = File.readlines(ARGV[0])
(rdb:1) l
[-2, 7] in problem.rb
1
2
=> 3 lines = File.readlines(ARGV[0])
4
5 lines.each do|l|
6 nums = l.split /,/
7 nums.map!{|n| n.to_f }
(rdb:1) exit
  1. About.com
  2. Computing
  3. Ruby
  4. Advanced Ruby
  5. Listing Source Code

©2014 About.com. All rights reserved.