Njeshe Amal “ARTicle” blog

If you want to go quickly, go alone. If you want to go far, go together.


· An Informal Introduction
· To Bootstrap, or Not To

· Redux: What The Flow?

· Get Started: Node/Express


Computer scientist, Lisa Gelobter, assisted with the 1995 creation of Shockwave, essential technology that led to the development of web animation. (So, we have her to thank for GIFs).

Every morning, a gazelle wakes up. It knows it must run faster than the fastest lion or it will be killed. Every morning, a lion wakes up. It knows it must outrun the slowest gazelle or it will starve to death. It doesn’t matter whether you’re a lion or gazelle. When the sun comes up, you’d better be running.

︎  ︎  

ART—icle 07

Debugging with Pry.

Learn what it is and how to use it.

Debugging your code can be a daunting, and sometimes debilitating, task if you’re ill-equipped. Today, I would like to share with you a great tool to use for debugging. You’re welcome.
Pry is a REPL. REPL stands for Read, Evaluate, Print, Loop. A REPL is an interactive programming environment. It is a tool that takes a user’s input, evaluates it, and returns a result. 

Using Pry, the code we’re running pauses its execution and we enter into the Pry REPL. In it, we can manipulate data in various ways. So, how does it work?

In the file that you want to work in, you must require Pry, like so:

require 'pry'

In order to have access to Pry, it must be added to the Gemfile or installed locally. Visit RubyGems for Pry or other Ruby tools.

We added Pry to our Gemfile, we ran bundle install or gem install pry in our terminal, now what?

Let’s take a look at how we can call pry inside a method. Take a look at this example:

Inside a method, to initiate Pry, we must use “binding.pry”. This will pause the execution of our program and enter the Pry REPL. From there, we can manipulate the data in whichever way makes sense for us. 

Pro Tip: Any variables defined after binding.pry in the method will return nil. Only variables defined before binding.pry will have a return value.

Thanks for stopping by 🙃️, BYE!