Pry is an interactive Ruby shell with deep introspection. It supports browsing source and docs, navigating object scope, and pausing live programs via binding.pry.
Overview
Pry replaces or augments the default IRB experience for Ruby with a command-driven console focused on exploration and debugging. Sessions run from the pry executable or embed inside a running program, exposing bindings, locals, and methods at the pause point.
Navigation commands let you move between contexts with cd, inspect available methods and variables with ls, track nesting levels, and jump between frames. show-source displays Ruby methods and, with the pry-doc gem, some core C implementations with paging and highlighting. show-doc and ri integration fetch method and class documentation on demand.
Editing workflows open methods in your configured editor via edit, reload changes automatically unless disabled, and integrate with the host shell: lines starting with a dot pass through to the system shell, and shell-mode adds directory-aware prompts and filename completion. Syntax highlighting is on by default and configurable through themes.
Runtime invocation via binding.pry or object.pry supports debugging, ad hoc consoles, and hot patches without restarting the process. Pry can replace the Rails console through gems or flags, and supports CRuby from 2.0 and JRuby from 9.0.
Key features
- Source and documentation browsing
- Scope navigation with cd and ls
- binding.pry runtime breakpoints
- Shell and editor integration
- Syntax-highlighted output
- Command-based extensibility
- Session history replay
- Rails console compatibility
Use cases
- Exploring unfamiliar Ruby libraries interactively
- Debugging live web requests in development
- Reading method source during incident triage
- Custom Ruby-based interactive shells
- Teaching Ruby with rich introspection