Ruby 2.4 will have the feature to introduce a REPL session, using IRB, in between your code execution for better debugging. IRB, which stands for Interactive Ruby, is the standard REPL which is bundled along with ruby. Pry is a popular alternative for IRB, which has many developer-friendly features like tab compilation and syntax highlighting. One of the most heavily used features of pry is the ability to introduce a REPL session in between your code execution for better debugging. Instead of using p or puts to print the result and various variables, this helps us try out various codes and fixes in between the code to find the right solution.

binding.pry being used.

 

To use binding.irb in your code, you need to require the IRB library to your code and call binding.irb where you want to introduce the REPL.

and you will see a REPL like below.

screen-shot-2016-11-22-at-10-47-27-am