What is Pry?

What is Pry?

Pry is a REPL (Read, Evaluate, Print, Loop) that pauses your code wherever inserted and allows you to test/debug. When your code gets to the ‘pry’ it will freeze and your terminal will turn into a REPL right in the middle of your program.

Using Pry

The first step is to make sure you have the pry gem installed by typing the following into your terminal:

gem install pry

Once it’s installed, you will have to require it at the top of any file you plan on using it in like so:

# test.rb

require 'pry'