1. Home
  2. Computing & Technology
  3. Ruby

Listing Source Code

By , About.com Guide

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

Explore Ruby
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Ruby
  4. Advanced Ruby
  5. Listing Source Code

©2010 About.com, a part of The New York Times Company.

All rights reserved.