Code Monkey home page Code Monkey logo

pry-stack_explorer's Introduction

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.

pry-stack_explorer's People

Contributors

amatsuda avatar banister avatar brchristian avatar conradirwin avatar epitron avatar fursich avatar grstearns avatar hanachin avatar joallard avatar karlwilbur avatar kyrylo avatar moskyb avatar nhosoya avatar r-obert avatar rrosenblum avatar shawn42 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.