IRB(1)

πŸ“¦ version 3.1.2, in debian bookworm

πŸ’– IRB(1) β€” the Ruby Programmer's Reference Guide page, but make it a group chat πŸ’–

okay bestie, so this is the manual page for irb β€” literally the interactive Ruby shell, the place where you and Ruby just vibe together in real time. she's part of the Ruby Programmer's Reference Guide, she's been holding it down forever, and she's about to be your new favorite hangout. no cap. 🌸


✨ NAME ✨

irb β€” Interactive Ruby Shell. that's it, that's the name, she's iconic πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

the whole vibe in one shot, no skips:

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 ...]

🌈 DESCRIPTION 🌈

irb is the REPL (that's read-eval-print loop, bestie β€” read it, evaluate it, print it, loop it, over and over like your favorite playlist) environment for Ruby programs. you type Ruby, Ruby talks back, y'all go back and forth forever. main character energy fr fr ✨


πŸŽ€ OPTIONS πŸŽ€

every single one, no gatekeeping:

  • --version β€” prints the version of irb. the "hi what's your sign" of flags.
  • -E external[:internal], --encoding external[:internal] β€” same as ruby -E. sets the default value(s) for external encodings and internal encoding. separate those values with a colon (:).
    • you can totally omit the internal encoding one, and then the value (Encoding.default_internal) will be nil. ghosted, basically.
  • -I path β€” same as ruby -I. specifies $LOAD_PATH directory.
  • -U β€” same as ruby -U. sets the default value for internal encodings (Encoding.default_internal) to UTF-8.
  • -d β€” same as ruby -d. sets $DEBUG to true.
  • -f β€” suppresses read of ~/.irbrc. like airplane mode for your config file πŸ›«
  • -w β€” same as ruby -w.
  • -W β€” same as ruby -W.
  • -h, --help β€” prints a summary of the options. the "just tell me what's going on" button.
  • -r library β€” same as ruby -r. causes irb to load the library using require.
  • --inspect β€” uses inspect for 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. aesthetic βœ…
  • --nocolorize β€” don't use colorization.
  • --autocomplete β€” use autocompletion. she finishes your sentences, and honestly? she's right.
  • --noautocomplete β€” don't use autocompletion.
  • --verbose β€” show details.
  • --noverbose β€” don't show details.
  • --prompt mode, --prompt-mode mode β€” switch prompt mode. the pre-defined prompt modes are default, simple, xmp and inf-ruby.
  • --inf-ruby-mode β€” uses prompt appropriate for inf-ruby-mode on emacs. suppresses --multiline and --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 πŸ’œ

  • IRBRC
  • also irb depends on same variables as ruby(1). so go read that one too, iykyk.

πŸ“ FILES πŸ“

  • ~/.irbrc β€” personal irb initialization. your little home-cooked setup, your secret sauce 🫢

⭐ EXAMPLES ⭐

a whole conversation, look how cute she 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
%

she said => :t, she said :ok, she said goodbye with quit. a full arc. ate and left no crumbs πŸ”₯


🌸 SEE ALSO 🌸

ruby(1). your other bestie.


😭 REPORTING BUGS 😭

listen, this part is serious, so pay attention bestie:
  • 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. that's a whole leak situation, do not do it πŸ™ˆ

πŸ‘‘ AUTHORS πŸ‘‘

Written by Keiju ISHITSUKA. thank you for your service, legend πŸ’…


and that's the page!! this came out of the UNIX manual set, version dated August 11, 2019, filed under IRB(1) β€” so if you ever need to cite her, that's the receipt. go forth and REPL, bestie, you're gonna slay πŸ’–βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from