IRB(1)
π IRB(1) π
okay so bestie, welcome to IRB(1), the UNIX manual page for irb. buckle up π
β¨ SYNOPSIS β¨
irb [--version] [-dfUw] [-I directory] [-r library] [-E
external[:internal]] [-W[level]] [--[no]inspect] [--[no]multiline]
[--[no]singleline] [--[no]echo] [--[no]colorize] [--[no]autocomplete]
[--[no]verbose] [--prompt mode] [--prompt-mode mode] [--inf-ruby-mode]
[--simple-prompt] [--noprompt] [--tracer] [--back-trace-limit n] [--]
[program_file] [argument ...]
that's the whole flag buffet in one gloriously long line, and yes, every single one of those gets explained below. no skipping. we don't do that here π
πΈ DESCRIPTION πΈ
irb is the REPL (read-eval-print loop) environment for Ruby programs.
like, that's the whole vibe: it reads your Ruby, evaluates it, prints what came back, and then loops right back around for more. main character energy fr fr π
π OPTIONS π
--versionβ Prints the version of it. (the manual's sentence literally just stops there β a cliffhanger, we love that for us π)-E external[:internal],--encoding external[:internal]β Same asruby -E. Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:). You can omit the one for internal encodings, then the value (Encoding.default_internal) will benil.-I pathβ Same asruby -I. Specifies$LOAD_PATHdirectory.-Uβ Same asruby -U. Sets the default value for internal encodings (Encoding.default_internal) to UTF-8.-dβ Same asruby -d. Sets$DEBUGto true.-fβ Suppresses read of~/.irbrc. (your personal config file justβ¦ doesn't get read. ghosted π«₯)-wβ Same asruby -w.-Wβ Same asruby -W.-h,--helpβ Prints a summary of the options.-r libraryβ Same asruby -r. Causes irb to load the library using require.--inspectβ Usesinspectfor output (default except for bc mode).--noinspectβ Doesn't use inspect for output.--multilineβ Uses multiline editor module.--nomultilineβ Doesn't use multiline editor module.--singlelineβ Uses singleline editor module.--nosinglelineβ Doesn't use singleline editor module.--extra-doc-dirβ Add an extra doc dir for the doc dialog.--echoβ Show result (default).--noechoβ Don't show result.--echo-on-assignmentβ Show result on assignment.--noecho-on-assignmentβ Don't show result on assignment.--truncate-echo-on-assignmentβ Show truncated result on assignment (default).--colorizeβ Use colorization. π--nocolorizeβ Don't use colorization.--autocompleteβ Use autocompletion.--noautocompleteβ Don't use autocompletion.--regexp-completorβ Use regexp based completion.--type-completorβ Use type based completion.--verboseβ Show details.--noverboseβ Don't show details.--prompt mode,--prompt-mode modeβ Switch prompt mode. Pre-defined prompt modes aredefault,simple,xmpandinf-ruby.--inf-ruby-modeβ Uses prompt appropriate for inf-ruby-mode on emacs. Suppresses--multilineand--singleline.--simple-promptβ Makes prompts simple.--nopromptβ No prompt mode.--tracerβ Displays trace for each execution of commands.--back-trace-limit nβ Displays backtrace top n and tail n. The default value is 16.
π¦ ENVIRONMENT π¦
IRB_LANGβ The locale used for it. (another sentence that just ends mid-thought, iconic honestly)IRBRCβ The path to the personal initialization file.XDG_CONFIG_HOMEβ irb respectsXDG_CONFIG_HOME. If it is set andIRBRCis unset, load$XDG_CONFIG_HOME/irb/irbrcas a personal initialization file.RI_PAGERβ The command specified would be used as a pager.PAGERβ The command specified would be used as a pager ifRI_PAGERis unset.VISUALβ Its value would be used to open files by the edit command.EDITORβ Its value would be used to open files by the edit command ifVISUALis unset.NO_COLORβ Assigning a value to it disables colorization.IRB_USE_AUTOCOMPLETEβ Assigningfalseto it disables autocompletion.IRB_COMPLETORβ Autocompletion behavior. Allowed values areregexportype. (and yes, it's spelledIRB_COMPLETORin the manual β that's not me, don't come for me π)
Also irb depends on same variables as ruby(1). so like, go read that one too bestie π«Ά
π FILES π
~/.irbrcβ Personal irb initialization. IfIRBRCis set, read$IRBRCinstead. IfIRBRCis not set andXDG_CONFIG_HOMEis set,$XDG_CONFIG_HOME/irb/irbrcis loaded.
π EXAMPLES π
live footage of irb being that girl:
% irb
irb(main):001:0> 1 + 1
2
irb(main):002:0> def t(x)
irb(main):003:1> x + 1
irb(main):004:1> end
=> :t
irb(main):005:0> t(3)
=> 4
irb(main):006:0> if t(3) == 4
irb(main):007:1> p :ok
irb(main):008:1> end
:ok
=> :ok
irb(main):009:0> quit
%
math, a method, an if, a p :ok, and then quit when you're done. the whole character arc in nine lines β
π₯ SEE ALSO π₯
π REPORTING BUGS π
- Security vulnerabilities should be reported via an email to security@ruby-lang.org. Reported problems will be published after being fixed.
- Other bugs and feature requests can be reported via the Ruby Issue Tracking System (https://bugs.ruby-lang.org/). Do not report security vulnerabilities via this system because it publishes the vulnerabilities immediately.
fr fr, security stuff goes to the email, NOT the tracker. the tracker publishes immediately and that is lowkey a disaster for everyone involved π
π AUTHORS π
Written by Keiju ISHITSUKA. thank you king π«Ά
and that's the whole page! this beauty is from the Ruby Programmer's Reference Guide, dated August 11, 2019, and it lives at section IRB(1) of the UNIX manual. go forth and REPL responsibly bestie β¨π
π¦ where this page comes from
- alpine 3.22: ruby-doc 3.4.12-r0 Β· Ruby AND BSD-2-Clause AND MIT
- alpine 3.23: ruby-doc 3.4.12-r0 Β· Ruby AND BSD-2-Clause AND MIT
- alpine 3.24: ruby-doc 3.4.12-r0 Β· Ruby AND BSD-2-Clause AND MIT
- opensuse-leap 16.0: ruby3.4 3.4.10-160000.1.1 Β· BSD-2-Clause OR Ruby
- opensuse-leap 16.0: ruby3.4 3.4.10-160000.1.1 Β· BSD-2-Clause OR Ruby
- opensuse-leap 16.0: ruby3.4 3.4.10-160000.1.1 Β· BSD-2-Clause OR Ruby
- opensuse-leap 16.0: ruby3.4 3.4.10-160000.1.1 Β· BSD-2-Clause OR Ruby
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms