Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Available plugins

David Rodríguez edited this page · 24 revisions

Quick Menu:

  1. pry-byebug / code
  2. pry-coolline / code
  3. pry-remote / code
  4. pry-remote-em / code
  5. pry-stack_explorer / code
  6. pry-exception_explorer / code
  7. pry-vterm_aliases / code
  8. pry-syntax-hacks / code
  9. pry-em / code
  10. pry-theme / code
  11. pry-toys / code
  12. pry-macro / code
  13. pry-debugger / code

pry-byebug

Author: deivid-rodriguez Ruby versions: 2.0+ MRI

Adds next ,step, finish and continue commands to Pry for stepping through your program's code and up, down and frame commands for callstack navigation.

[1] (pry) main: 0> step

From: ./y.rb @ line 4 in Object#hello:

    1: require 'pry-byebug'
    2:
    3: def hello
 => 4:   puts 'Hello'
    5: end
    6:
    7: binding.pry
    8: hello

For Ruby 1.9 alternatives, checkout pry-debugger and pry-stack_explorer

Back to top

pry-coolline

Author: Mon_Ouie Ruby versions: 1.9.2+ MRI

Pry-coolline is a nifty little Readline replacement that takes advantage of the new stdlib io-console library to provide live syntax highlighting for user input. It's unfortunately limited to Ruby versions 1.9.2+ and MRI, but generally works well.

Back to top

pry-remote

Author: Mon_Ouie

Pry-remote (along with its cousin pry-remote-em) enables you to start instances of Pry in a running program and connect to those instances over a network or the Internet. Once connected you can interact with the internal state of the program. This plugin comes into its own when used with tools such as Pow, enabling you to get a Pry session in places not normally possible. pry-remote is also notable for having pry-nav support.

We set up the server as follows:

require 'pry-remote'

class Foo
  def initialize(x, y)
    binding.remote_pry
  end
end

Foo.new 10, 20

Back to top

pry-remote-em

Author: simulacre Ruby versions: 1.9.2+ MRI

Pry-remote-em is a sophisticated EventMachine-based alternative to pry-remote. It adds user authentication and SSL support along with tab-completion and paging. It also allows multiple clients to connect to the same server, and multiple servers to run on the same computer and even within the same process. pry-remote-em is one of the most exciting projects in the Pry ecosystem, as it opens up possibilities for multi-user remote-debugging/exploration, as well as educational applications. It is also just fun to interact with other programmers in a live environment. One limitation of pry-remote-em at the moment is the lack of pry-nav support, but this will be added in the future.

Starting the pry-remote-em server:

require 'pry-remote-em/server'

class Foo
  def initialize(x, y)
    binding.remote_pry_em
  end
end

EM.run { Foo.new 10, 20 }

Back to top

pry-stack_explorer

Author: banisterfiend Ruby versions: 1.9.2+ MRI

Pry-stack_explorer  is a powerful plugin that enables navigation of your program's call-stack. From the point a Pry session is started, you can move up the stack through parent frames, examine state, and even evaluate code. Unlike some other debuggers, pry-stack_explorer incurs no runtime cost and enables navigation right up the call-stack to the birth of the program. Together with the pry-nav plugin, it should provide the user with a fairly complete and fast debugging experience in Ruby 1.9.2+ MRI. Pry-stack_explorer provides the show-stack comand as well as up and down

[1] (pry) main: 0> show-stack

Showing all accessible frames in stack (5 in total):
--
=> #0 [method] gamma <Object#gamma()>
 #1 [method] beta <Object#beta()>
 #2 [method] alpha <Object#alpha()>
 #3 [eval] <main>
 #4 [top] <main>

Back to top

pry-exception_explorer

Author: banisterfiend Ruby versions: 1.9.2+ MRI

Pry-exception_explorer is an interactive error console for MRI Ruby 1.9.2+ inspired by the Hammertime gem, which was in turn inspired by consoles found in the Lisp and Smalltalk environments. Unlike the Hammertime gem, we are dropped into the actual context of the exception (with full access to local state) and can even walk the stack (using pry-stack_explorer, discussed above) to isolate the cause of the exception. Rudimentary support for some C-level exceptions is also provided and activated with a command line switch. Another feature of pry-exception_explorer is the ability to define exactly when it kicks-in. This can be as simple as specifying an exception type, or as sophisticated as an assertion over the entire state of the stack. The Plymouth gem works by defining a number of stack assertions for each of the testing libraries it supports. In the example below, we configure a stack assertion so that exception explorer starts when an ArgumentError is raised, but only if the exception context is an instance of MyClass and the parent's context is an instance of MyCallingClass:

EE.intercept do |frame, ex|
  ex.is_a?(ArgumentError) && frame.klass.is_a?(MyClass)) &&
  frame.prev.klass.is_a?(MyCallingClass)
end

However, this plugin has been deprecated in favor of pre-rescue.

Back to top

pry-vterm_aliases

Author: EnvyGeeks Ruby versions: 1.8.7+, 1.9+

Pry-VTerm_Aliases brings your bash and zsh aliases into Pry as known shell commands.

Back to top

pry-syntax-hacks

Author: Conrad Irwin Ruby versions: all

Pry-syntax-hacks adds some syntactic sugar to Pry. Most usefully it allows you to look at instance variables of objects: user.@password, call private/protected methods on objects: user.!hash_password('test'). It also lets you access methods: passwords.map user.&hash_password, and access variables in previously active pry bindings (a.la. cd): puts ../a.

Back to top

pry-em

Author: Conrad Irwin Ruby versions: all

Pry-em adds an em: command which allows you to run code in an EventMachine context. It also waits for asynchronous operations to complete, and binds to the callback and errback of deferrables.

Back to top

pry-theme

Author: Kyrylo Silin
Ruby versions: all

Pry Theme plugin helps you to customize your Pry colors via prytheme files. It adds pry-theme command, which allows you to test themes on the fly and and install new ones.

Put your Pry theme in ~/.pry/themes directory and set it up in your config:

# ~/.pryrc
Pry.config.theme = "theme-name"

Back to top

pry-toys

Author: Alex Riabov
Ruby versions: all

Pry Toys adds easy ways to create complex throwaway Ruby object in pry. Now you can quickly create Array of Floats:

Array.toy(3, Float) # => [1.0, 2.0, 3.0]

or Hash with 300 keys:

Hash.toy(300) # => { a: 1, b: 2, ..., kn: 300 }

or String with 2 words:

String.toy(2) # => "ttttttt oooo"

After gem is installed, these toy / throwaway Ruby objects are going to be available for creation when pry is started. To learn more about other arguments you can use to customize toy objects, click here

Back to top

pry-macro

Author: Brandon Weaver
Ruby versions: all

Pry Macro allows you to record a workflow, define a command, and save macros to your .pryrc. This works with both plain ruby and pry commands.

[1] pry(main)> record
[2] pry(main)> 1
=> 1
[4] pry(main)> ls
self.methods: inspect  to_s
locals: _  __  _dir_  _ex_  _file_  _in_  _out_  _pry_

[5] pry(main)> stop -n testing -d 'A test command!'

Run it like any other command:

[6] pry(main)> testing
=> 1
self.methods: inspect  to_s
locals: _  __  _dir_  _ex_  _file_  _in_  _out_  _pry_

Like it? You can save it and have it automatically append to your PryRC:

[10] pry(main)> save-macro testing

Back to top

pry-debugger

Author: Nixme Ruby versions: 1.9 MRI

This is the old debugging plugin for Ruby 1.9. Still useful to aid upgrading or for legacy code.

Back to top

Something went wrong with that request. Please try again.