IRB(1)

πŸ“¦ version 3.4.10, in opensuse-leap 16.0

πŸ’– 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 as ruby -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.
  • -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. (your personal config file just… doesn't get read. ghosted πŸ«₯)
  • -w β€” Same as ruby -w.
  • -W β€” Same as ruby -W.
  • -h, --help β€” Prints a summary of the options.
  • -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. 🌈
  • --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 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 πŸ¦‹

  • 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 respects XDG_CONFIG_HOME. If it is set and IRBRC is unset, load $XDG_CONFIG_HOME/irb/irbrc as 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 if RI_PAGER is 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 if VISUAL is unset.
  • NO_COLOR β€” Assigning a value to it disables colorization.
  • IRB_USE_AUTOCOMPLETE β€” Assigning false to it disables autocompletion.
  • IRB_COMPLETOR β€” Autocompletion behavior. Allowed values are regexp or type. (and yes, it's spelled IRB_COMPLETOR in 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. If IRBRC is set, read $IRBRC instead. If IRBRC is not set and XDG_CONFIG_HOME is set, $XDG_CONFIG_HOME/irb/irbrc is 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 πŸ”₯

ruby(1).


πŸ’€ 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