- Add these gems in gemfile or gemspec:
gem 'ruby-debug'
gem 'columnize'
- Add
require 'ruby-debug'
in your project. - Add breakpoints with
debugger
keyword. - Run
jruby
with--debug
flag:
jruby --debug -S bundle exec <command>
Unlike pry
or byebug
where we can simply call the variable to see its value, we have to use p
to print the value. For example, my_var
vs p my_var
. We can change this behavior to autoeval
by adding the following lines to a ~/.rdebugrc
file:
set autolist
set autoeval
set autoreload
SimpleCov does not work with ruby-debug. Temporarily uncomment it from your MRI based while it runs on JRuby. See ruby-debug/ruby-debug#27 for more information.
https://github.com/jruby/jruby/wiki/UsingTheJRubyDebugger https://gist.github.com/klappradla/69029a982ade44e20e124c29b1c00541