Make sure you have the gem installed:
$ gem install pry-byebug- Require the gem at the top of your file
- Add the
binding.pryto your code
require 'pry-byebug'
# Top here ☝️
# ...
# Tons of code
# ...2. Add the binding.pry to set your stop marker. It stops the execution of the code before the next line.
puts 'Hello World'
binding.pry
puts 'Goodbye World' # <<< Execution will stop before thisIt will look like this:
1: puts 'Hello World'
2: binding.pry
=> 3: puts 'Goodbye World'
[1] pry(main)> # <<< You can type commands hereStep over to the next line within the same frame. Also takes an optional numeric argument to step multiple lines.
Continue program execution until next marker (yes, you can set multiple binding.pry in your code).
Closes the pry session. Pretty handy if you're stuck on an endless loop.