What is PRY? Why do we need PRY? Why read an article on PRY? Some of these questions might pop up in your mind when you read the title of this blog. Let me explain why you should be knowing about PRY.
PRY is an attempt to remake IRB, the interactive Ruby interpreter, in a way that makes more sense for mordern programmers. Some of the most important features of PRY are syntax highlighting, code indentation and code debugging. In other words, instead of coding inside a REPL session, you can start a REPL session inside your code execution with the help of PRY.
Since PRY is a Ruby gem, installing it is straightforward. The following commands will work:
$ gem install pry
PRY colorizes the syntax as it is typed into the console just like most mordern editors. In addition to this, PRY also auto-indents code thus allowing ensuring that the ‘end’ words line up with the lines that open the block.
pry(main) > class User
pry(main)* def greet
pry(main)* puts “Hello world”
Another cool feature of PRY, as per my opinion, is it’s ability to show a method’s documentation …