Quickstart
Install Pry:
Try it out: (Displaying source for FileUtils.rm)
For comprehensive coverage of Pry's features please check out the Wiki and watch the screencasts.
Pry is a powerful alternative to the standard IRB shell for Ruby. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing.
Install Pry:
Try it out: (Displaying source for FileUtils.rm)
For comprehensive coverage of Pry's features please check out the Wiki and watch the screencasts.
It is recommended you watch the following screencast put together by Josh Cheek. It includes instructions on installing Pry as well as some coverage of core features.
Pry is written from scratch to provide a number of advanced features, some of these include:
Pry also aims to be more than an IRB replacement; it is an attempt to bring REPL driven programming to the Ruby language. It is currently not as powerful as tools like SLIME for lisp, but that is the general direction Pry is heading.
Pry is also fairly flexible and allows significant user customization making it a good choice for implementing custom shells.
Pry can be invoked in the middle of a running program. It opens a Pry session at the point it's called and makes all program state at that point available. When the session ends the program continues with any modifications you made to it.
This functionality can be used for such things as: debugging, implementing developer consoles and applying hot patches.
Pry session:
A line of input that begins with a '.' will be forwarded to the command shell. This enables us to navigate the file system, spawn editors, and run git and rake directly from within Pry.
Further, we can use the shell-mode command to incorporate the present working directory into the Pry prompt and bring file name completion. We can also interpolate Ruby code directly into the shell by using the normal #{} string interpolation syntax.
In the code below we're going to switch to shell-mode and edit the .pryrc file in the home directory. We'll then cat its contents and reload the file.
If you liked Pry and found it useful, please consider making a donation to support its continued development!
Pry was a huge amount of work and every dollar received is encouraging!
The Pry core team are John Mair (project founder; aka banisterfiend; twitter; blog), Conrad Irwin and Ryan Fitzgerald. The project is also aided by a healthy number of contributors.
To participate in Pry's development (and get your name on the list!) see the wiki article on how to contribute.