Ruby — All paths leads to pry

Often, in any programming language you will need and use some sort of interactive programming shell. Of course, you already have one in Ruby, it is called irb. IRB stands for “interactive ruby” and is a tool to interactively execute ruby expressions read from the standard input.Idea behind irb, is simple, and it is based on REPL concept. What REPL is?

REPL is READ — EVAL — PRINT-LOOP.

And it is really easy to implement one by yourself in Ruby language. In just one line of code.

$ loop { p eval gets }

Code is pretty straightforward, p stand shorthand inspect, where eval executes code which Ruby gets from commandline.

But what if you want to use something more powerfull?

Answer is pry, and you most allready heard of it.

As Pry is distributed as gem, you can install it with:

$ gem install pry pry-doc --no-ri --no-rdoc

pry-doc is here to get access to Ruby Core documentation.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.