Pry is an excellent alternative to IRb with syntax highlighting and proper indentation.
You can install pry
by simply running the command
gem install pry
And then on the command line, run it!
> pry
But the best thing about pry
is that it brings an REPL (read-eval-print-loop) session directly to your code! Just do the following.
require 'pry'
# Code above
binding.pry
#Code below
and it will display the session at the point where you’ve placed the method. You can play around with your code and then exit with the command exit
.
For more details, check out
* Pry Home