IRB(1)

πŸ“¦ version 3.0.2, in ubuntu jammy

πŸ’– IRB β€” the Ruby REPL, bestie edition πŸ’–

okay so real talk, the manual name is irb, and yes it lives in the Ruby Programmer's Reference Guide section of your man pages. it's giving "interactive ruby shell" and honestly? it ate.

✨ NAME ✨

irb β€” Interactive Ruby Shell πŸ¦‹


🌸 SYNOPSIS 🌸

irb [--version] [-dfUw] [-I directory] [-r library]
    [-E external[:internal]] [-W[level]] [--[no]inspect]
    [--[no]multiline] [--[no]singleline] [--[no]echo] [--[no]colorize]
    [--[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 (read-eval-print loop) environment for Ruby programs. that's it, that's the vibe. you type Ruby, it reads it, evaluates it, prints the result, and loops back around for more. main character energy fr fr πŸ’…


πŸ’… OPTIONS πŸ’…

  • --version β€” prints the version of irb. cute lil flex, lowkey useful.
  • -E external[:internal]
  • --encoding external[:internal] β€” same as ruby -E. it sets the default value(s) for external encodings and internal encoding. separate your values with a colon (:). you can totally skip the internal one, and then the value (Encoding.default_internal) will just be nil. no biggie.
  • -I path β€” same as ruby -I. tells it where your $LOAD_PATH directory is. 🧚
  • -U β€” same as ruby -U. sets the default value for internal encodings (Encoding.default_internal) to UTF-8. slay.
  • -d β€” same as ruby -d. sets $DEBUG to true.
  • -f β€” suppresses the read of ~/.irbrc. like, don't look at my config, it's not ready 😭
  • -w β€” same as ruby -w.
  • -W β€” same as ruby -W.
  • -h
  • --help β€” prints a summary of the options. for when you're lost but too proud to ask.
  • -r library β€” same as ruby -r. causes irb to load the library using require.
  • --inspect β€” uses inspect for output. this is the default, except for bc mode.
  • --noinspect β€” doesn't use inspect for output.
  • --multiline β€” uses the multiline editor module.
  • --nomultiline β€” doesn't use the multiline editor module.
  • --singleline β€” uses the singleline editor module.
  • --nosingleline β€” doesn't use the singleline editor module.
  • --echo β€” shows the result. this is the default ✨
  • --noecho β€” doesn't show the result. silent treatment, but make it code.
  • --colorize β€” uses colorization.
  • --nocolorize β€” doesn't use colorization. (why would you, but ok πŸŽ€)
  • --verbose β€” shows details.
  • --noverbose β€” doesn't show details.
  • --prompt mode
  • --prompt-mode mode β€” switches the prompt mode. the pre-defined prompt modes are default, simple, xmp and inf-ruby.
  • --inf-ruby-mode β€” uses a prompt that's appropriate for inf-ruby-mode on emacs. also suppresses --multiline and --singleline.
  • --simple-prompt β€” makes the prompts simple.
  • --noprompt β€” no prompt mode. feral. unhinged. iconic.
  • --tracer β€” displays trace for each execution of commands. watch it cook πŸ”₯
  • --back-trace-limit n β€” displays backtrace top n and tail n. the default value is 16.

🌈 ENVIRONMENT 🌈

  • IRBRC

also, irb depends on the same variables as ruby(1). iykyk.


πŸŽ€ FILES πŸŽ€

  • ~/.irbrc β€” personal irb initialization. this is where your whole personality lives tbh.

🫢 EXAMPLES 🫢

% 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
%

literally the whole arc: do math, define a method, call it, do a lil conditional, quit out. cinema. πŸ“


πŸ‘€ SEE ALSO πŸ‘€

ruby(1).


πŸ’€ REPORTING BUGS πŸ’€

okay bestie, listen up, this part is serious.
  • 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. no cap, don't do it πŸ™ˆ

⭐ AUTHORS ⭐

Written by Keiju ISHITSUKA. king behavior honestly πŸ‘‘


and that's the whole page, babes. this one's the IRB(1) page from the Ruby Programmer's Reference Guide, and the source line says it was dated August 11, 2019 β€” so yeah, this manual is a lil vintage but still absolutely serving. go type some Ruby, you got this πŸ’œβœ¨

πŸ“¦ where this page comes from