Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pry - An IRB Alternative on Steroids (Part 1)

Pry - An IRB Alternative on Steroids (Part 1)

Pry is a powerful alternative to the standard IRB shell for Ruby. It features syntax highlighting, a flexible plugin architecture, runtime invocation, debugging and source and documentation browsing.

Part 2 (https://speakerdeck.com/rahult/pry-an-irb-alternative-on-steroids-part-2)

Rahul Trikha

August 07, 2012
Tweet

More Decks by Rahul Trikha

Other Decks in Programming

Transcript

  1. Agenda • Pry? • Installation • Navigation • Viewing documentation

    • Viewing code • Editing code • Runtime invocation • Exception handling • What’s next?
  2. Pry? 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. http://pryrepl.org/
  3. Installation $ gem install pry $ pry $ gem 'pry-rails',

    :group => :development $ rails console
  4. Editing code You can use edit-method Class#method or edit-method my_method

    (if the method is in scope) to open a method for editing directly in the default editor. Pry will attempt to jump to the line in the file where the method is defined.
  5. Runtime invocation Aside from using Pry as an IRB-alternative it

    also has the ability to function as a developer console and lightweight debugger. To use Pry in this capacity it must be invoked at runtime in the middle of a running program.
  6. Exception handling Pry catches most of the exceptions that your

    code raises so that you have time to work out what went wrong and fix the problem.
  7. What’s next • pry wiki - https://github.com/pry/pry/wiki • pry irc

    - #pry • pry-remote - https://github.com/Mon- Ouie/pry-remote • pry-debugger - https://github.com/nixme/ pry-debugger