January 2024
Intermediate to advanced
718 pages
20h 15m
English
In addition to the official Ruby debugger and the official irb client, there is a third-party alternative called Pry.[29]. Pry predates the Ruby 3.1 debugger and contains many overlapping features, but with a slightly different command-line interface.
To install Pry, you need the Pry gem. Pry also has a plugin system that allows extensions, and we’ll be adding the pry-byebug gem that gives step-by-step debugging control to Pry. You can add them to a Gemfile:
| | gem "pry" |
| | gem "pry-byebug" |
The main way to use Pry is by adding the method call binding.pry into a code base. If we do that with the same code we used for the debugger earlier, just by replacing require "debug" with require "pry" and the binding.break call with binding.pry we ...
Read now
Unlock full access