Slide 1

Slide 1 text

Rahul Trikha An IRB Alternative on Steroids

Slide 2

Slide 2 text

Self Introduction • @rahult • https://github.com/rahult • Working for Katalyst Interactive

Slide 3

Slide 3 text

Agenda • Pry? • Installation • Navigation • Viewing documentation • Viewing code • Editing code • Runtime invocation • Exception handling • What’s next?

Slide 4

Slide 4 text

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/

Slide 5

Slide 5 text

Installation $ gem install pry $ pry $ gem 'pry-rails', :group => :development $ rails console

Slide 6

Slide 6 text

Navigation Changing scope with cd

Slide 7

Slide 7 text

Navigation Learning about your context with the ls command

Slide 8

Slide 8 text

Navigation Rapidly exploring with the find-method command

Slide 9

Slide 9 text

Viewing documentation View method and class documentation with show-doc Alias ?

Slide 10

Slide 10 text

Viewing code View method and class source code with show-source Alias $

Slide 11

Slide 11 text

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.

Slide 12

Slide 12 text

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.

Slide 13

Slide 13 text

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.

Slide 14

Slide 14 text

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