Pry Away the Bugs

Posted by Ryan Manchester on March 13, 2018

As I’m making my way through the Object Oriented unit of Ruby, I’m gaining a deeper understanding of how to debug with ‘pry’. For those who don’t know, ‘pry’ is a powerful way to go inside (or “pry into”) a particular method in a program to test its functionality as well as your coding syntax. It also won’t go inside the method if the method itself is broken, therefore revealing bugs within the code before breaking into it.

The benefits to this powerful form of debugging methods within a program is valuable in not only knowing whether the method works at all, but it aslo allows you to exits inside the method in question and send it different lines of code. What this does is to reveal what exact information is either stored or accessible to that method and allows you to find your own ways of exposing the desired information in order to get the method functioning properly.

Addmittedly, it took me quite a while to grasp exactly what ‘pry’ was doing and how it is helpful. Now that I have a firm grasp on its usfulness, I’ve saved myself time by answering my own questions about a specific method, and I am able to gain a much deeper understanding on every line of code I’m writing. Understanding what I’m writing and why it works (or not) has proven essential in my journey from never writing a single line of code to now confidently writing code for the final Object Oriented Ruby projects.