Skip to content

pry/pry-stack_explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Feb 8, 2021
e3e6bd2 · Feb 8, 2021
May 22, 2020
Jul 12, 2012
Feb 8, 2021
Dec 31, 2020
Nov 11, 2011
May 22, 2020
May 22, 2020
Dec 31, 2020
Nov 11, 2011
Feb 8, 2021
May 21, 2020
Nov 11, 2011
Jan 13, 2021
Aug 17, 2020
Jan 25, 2021

Repository files navigation

pry-stack_explorer

Walk the stack in a Pry session


Pry::StackExplorer is a plugin for Pry that allows navigating the call stack.

From the point a Pry session is started, the user can move up the stack through parent frames, examine state, and even evaluate code.

Unlike ruby-debug, pry-stack_explorer incurs no runtime cost and enables navigation right up the call-stack to the birth of the program.

The up, down, frame and stack commands are provided. See Pry's in-session help for more information on any of these commands.

Usage

Provides commands available in Pry sessions.

Commands:

  • up/down - Move up or down the call stack
  • frame [n] - Go to frame n
  • stack - Show call stack

Install

In Gemfile:

gem 'pry-stack_explorer', '~> 0.6.0'
gem install pry-stack_explorer

Branches and compatible Ruby versions

  • v0.5, v0.6: Ruby 2.6+, Pry 0.13+
  • v0.4.11+: Ruby 2.5, Pry 0.12+ (branch 0-4 – end-of-life in March 2021)
  • v0.4.9.3: Older versions (unsupported)

Example:

Here we run the following ruby script:

require 'pry-stack_explorer'

def alpha
  x = "hello"
  beta
  puts x
end

def beta
  binding.pry
end

alpha

We wander around the stack a little bit, and modify the state of a frame above the one we binding.pry'd at.

asciicast

Output from above is Goodbye as we changed the x local inside the alpha (caller) stack frame.

License

Released under the MIT License by John Mair (banisterfiend) and contributors

Contributions to this gem are released under the same license.