Using ruby-debug
... require 'ruby-debug' class ProjectX_handler def invoke(project, method, params) Debugger.start { h = Hash.new h['car_log'] = Car_log_handler.new h['recordx'] = RecordX_handler.new h['mrecord'] = MRecord_handler.new h['fileop'] = FileOp_handler.new h['rx2projectx'] = RX2ProjectX_handler.new h['blog'] = Blog_handler.new h[project].invoke(method, params) } end debug_method :invoke end ...
at the (rdb:1) prompt you can type help for information on debugger commands. Commands I've tried so far are
'step' (move to the next statement),
list (show the current line of execution and the fragment of code which the debugger is current analysing),
'break projectx_handler.rb:29' (go to the following line within the file specified, when execution is continued,
'continue' (resume normal code execution),
'v l' (display local variables), and
'p' (evaluate expression and print it's value)
Note: Ruby-debug would not install properly on *Ubuntu 7.10, but installed fine on Ubuntu 7.4 and Gentoo 2007.1.
* - extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
*update 12 Feb*
found out that I needed the Ruby dev header files to install the Ruby-debug gem. Here's how sudo apt-get install ruby1.8-dev