Wednesday, September 14, 2011

When debugging in python, I use ipython's ipdb debugger to set breakpoints. I can add the following code in the location I want to stop:
import ipdb; ipdb.set_trace()
I wanted something similar for ruby. I got the same behaviour set up with the following code and patching using irb_completion's output. Install the required gem files:
gem install ruby-debug-base
gem install ruby-debug
gem install wirble
gem install patch_irb_completion;patch_irb_completion
Modify the ruby file to be debugged:
require 'rubygems'
require 'ruby-debug'
require 'wirble'

debugger #location to stop
running the code with the --debug option will stop at the requested location and drop an rdb prompt with tab completion. Reference:

No comments: