3 ms·
binding.irb is indeed a superpower of Ruby (and its equivalent in a few other enlightened languages). binding.pry is even better, and worth the gem install.
by quesera 3y ago
binding.irb is indeed a superpower of Ruby (and its equivalent in a few other enlightened languages).
binding.pry is even better, and worth the gem install.
irb : sh :: pry : zsh
- nithinbekal 3y agoWhile this was true for a long time, Ruby's built in irb and debug gems have improved dramatically in the past couple of years. To the point that I've switched to them from pry+byebug that I've been using for years.
- ta988 3y agoOne advantage of byebug is that if you do a sleep in something with theeads like capybara tests, the browser becomes functional again. Which is not the case with irb/debug. I couldn't find a way to reproduce this behavior in recent debuggers.
- ativzzz 3y agoCan you do things like `next`, `step`, `up` or `caller` to go up/down the callstack like you can with pry?
- nithinbekal 3y agoYes, you can with irb:debug, which you can enter by typing debug one you're inside a binding.irb session.