PRY(1)
π
PRY β the pry(1) manual, bestie edition β¨
okay so. you opened the manual for PRY, and honestly? you're about to have a great time. this is the page for the PRY repl, and no cap, it's a whole vibe. πΈ
π NAME
PRY β A Reference to the PRY repl.
like. that's it. that's the name. iconic. π
π Synopsis
pry [--version] [--exec] [--no-pager] [--no-history] [--no-color] [-f]
[--no-plugins] [--installed-plugins] [--simple-prompt] [--require file]
[-I] [--context] [--help]
β¨ DESCRIPTION
so basically π Pry is a powerful alternative to the standard IRB shell for Ruby. it was written from scratch β from scratch, bestie, no hand-me-downs β specifically to provide a number of advanced features. it's giving main character energy in a repl. periodt.
π HOMEPAGE
π OPTIONS
here's the full menu, no skipping, we read every single one π«Ά
-v,--versionβ Prints the version of Pry. quick lil flex check. β¨-e,--execβ Executes argument in context before the session starts. like a lil warm-up stretch before the main performance. π₯--no-pagerβ Disable pager for long output. so when something dumps a novel at you, it just... dumps it. all at once. raw. π--no-historyβ Disable history loading. your past commands stay in the past, no receipts. π--no-colorβ Disable syntax highlighting for session. monochrome mode. we mourn. π₯²-fβ Prevent loading of~/.pryrcfor session. fresh start, blank slate, new era. π¦--no-pluginsβ Suppress loading of plugins. no extras, just vibes. β¨--installed-pluginsβ List installed plugins. show me the roster π--simple-promptβ Enable simple prompt mode (eg,>>). minimalist. understated. lowkey chic. π-r,--requireβ Require a ruby script at startup.-Iβ Add a path to the$LOAD_PATH-c,--contextβ Start the session in the specified context. Equivalent tocontext.pryin a session.
π FILES
~/.pryrcβ Personal pry initialization
that's the one. your little home file. your pry bedroom decor. π
πΈ EXAMPLES
π Basic Usage
$ pry
[1] pry(main)>4 + 5
=> 9
[2] pry(main)> def hello_world
[2] pry(main)* puts "Hello, World!"
[2] pry(main)* end
=> nil
[3] pry(main)> hello_world
Hello, World!
=> nil
look at her go. arithmetic, a method definition, and a little Hello, World! β she ate and left no crumbs. π
π Command Line Interaction
Prefix any command you want your shell to execute with a period and pry will return the results from your shell.
[1] pry(main)> .date
Fri Nov 11 09:52:07 EST 2011
yes bestie, a literal . and then boom, your shell does the thing and hands you back the output. π«
On the command line enter shell-mode to incorporate the current working directory into the Pry prompt.
pry(main)> shell-mode
pry main:/Users/john/ruby/projects/pry $ .cd ..
pry main:/Users/john/ruby/projects $ .cd ~
pry main:/Users/john $ .pwd
/Users/john
pry main:/Users/john $ shell-mode
pry(main)>
see how the prompt morphs into a whole filesystem-aware situation? shell-mode on, shell-mode off, and you're right back to pry(main)>. chefs kiss. π
π§ State Navigation
The cd command is used to move into a new object (or scope) inside a Pry session. When inside the new scope it becomes the self for the session and all commands and methods will operate on this new self.
pry(main)> self
=> main
pry(main)> cd Pry
pry(Pry):1> self
=> Pry
pry(Pry):1> cd ..
pry(main)>
you literally just move in. new scope, new self, new you. it's giving relocation era. π¦
The ls command is essentially a unified wrapper to a number of RubyΒ΄s introspection mechanisms, including (but not limited to) the following methods: methods, instance_variables, constants, local_variables, instance_methods, class_variables and all the various permutations thereof.
By default typing ls will return a list of just the local and instance variables available in the current context.
- The
-Moption selects public instance methods (if available). - The
-moption selects public methods. - The
-coption selects constants. - The
-ioption select just instance variables. - The
-loption selects just local variables. - The
-soption modifies the-cand-mand-Moptions to go up the superclass chain (excludingObject). - The
--grep REGEXprunes the list to items that match the regex.
so many flags, all of them useful, all of them yours. π«Ά
π Source Browsing
Simply typing show-method method_name will pull the source for the method and display it with syntax highlighting. You can also look up the source for multiple methods at the same time, by typing show-method method1 method2. As a convenience, Pry looks up both instance methods and class methods using this syntax, with priority given to instance methods.
pry(Pry):1> show-method rep
From: /Users/john/ruby/projects/pry/lib/pry/pry_instance.rb @ line 191:
Number of lines: 6
def rep(target=TOPLEVEL_BINDING)
target = Pry.binding_for(target)
result = re(target)
show_result(result) if should_print?
end
syntax highlighting AND the exact file and line number? that's not just a repl, that's a research tool. obsessed. π₯
π AUTHORS
Pry is primarily the work of John Mair (banisterfiend)
okay that's the whole page, bestie. every flag, every example, every file. nothing skipped, nothing watered down. you're basically a Pry expert now, iykyk. π β¨
PRY(1) β June 2014 π thank you for reading, love u, go open a repl and slay. πΈππ¦
π¦ where this page comes from
- debian bookworm: pry 0.13.1-3 Β· MIT
- debian trixie: pry 0.15.2-1 Β· MIT
- ubuntu jammy: pry 0.13.1-2 Β· MIT
- ubuntu noble: pry 0.14.2-1 Β· MIT
- ubuntu resolute: pry 0.15.2-1 Β· MIT
- ubuntu stonking: pry 0.16.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms