IRB(1)
β¨ IRB(1) β¨
okay so bestie, welcome to irb, the Interactive Ruby Shell β this is the page for it in the Ruby Programmer's Reference Guide, and honestly? it's giving main character energy for every Ruby dev's terminal. π
π NAME π
irb β Interactive Ruby Shell. that's it, that's the name, short and iconic. π
π¦ 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 ...]
like yes, that's a lot of flags. we'll get to every single one, don't worry bestie π«Ά
πΈ DESCRIPTION πΈ
irb is the REPL (read-eval-print loop) environment for Ruby programs. you type Ruby, it reads it, evaluates it, prints the result, and loops back around to let you do it again. it's the little conversation you have with your code and ngl it's kind of the best part of the language. π
π OPTIONS π
every flag, every one, no skips, no cap. β¨
--versionβ Prints the version ofirb.-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 be nil. so if you leave that part off, bestie, you get nil β that's just the deal.
-I pathβ Same asruby -I. Specifies$LOAD_PATHdirectory-Uβ Same asruby -U. Sets the default value for internal encodings (Encoding.default_internal) toUTF-8.-dβ Same asruby -d. Sets$DEBUGtotrue.-fβ Suppresses read of~/.irbrc. no personal config today, we're going in fresh π«-wβ Same asruby -w.-Wβ Same asruby -W.-h--helpβ Prints a summary of the options.-r libraryβ Same asruby -r. Causesirbto load the library usingrequire.--inspectβ Usesinspectfor output (default except for bc mode)--noinspectβ Doesn't useinspectfor 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). the default! so you already have it, slay--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.--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 forinf-ruby-modeon emacs. Suppresses--multilineand--singleline. not me suppressing two other flags at once π--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 is16.
π ENVIRONMENT π
IRB_LANGβ The locale used forirb.IRBRCβ The path to the personal initialization file.XDG_CONFIG_HOMEβirbrespectsXDG_CONFIG_HOME. If this is set, load$XDG_CONFIG_HOME/irb/irbrcas a personal initialization file.
Also irb depends on same variables as ruby(1). iykyk β check that page too bestie π«Ά
π§ FILES π§
~/.irbrcβ Personalirbinitialization. IfIRBRCis set, read$IRBRCinstead. IfIRBRCis not set andXDG_CONFIG_HOMEis set,$XDG_CONFIG_HOME/irb/irbrcis loaded.
β EXAMPLES β
okay here's the whole vibe in one session, look how cute this is π
% 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
%
the prompt even tells you what's going on β line number, nesting level, the whole lore. obsessed. π
π SEE ALSO π
π¨ REPORTING BUGS π¨
bestie, please read this part, it actually matters π
- 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, do NOT drop a security vuln in the public tracker, it gets published instantly and that's a whole mess. π
π AUTHORS π
Written by Keiju ISHITSUKA. π«Ά
and that's the page!! this one came out under the UNIX manual set, dated August 11, 2019 β so like, go open a terminal, run irb, and have the best time. mwah πβ¨
π¦ where this page comes from
- ubuntu noble: ruby3.2 3.2.3-1build3 Β· BSD-2-Clause OR Ruby
- ubuntu noble: ruby3.2 3.2.3-1ubuntu0.24.04.8 Β· BSD-2-Clause OR Ruby
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms