IRB(1)
π 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 ofirb. cute lil flex, lowkey useful.-E external[:internal]--encoding external[:internal]β same asruby -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 benil. no biggie.-I pathβ same asruby -I. tells it where your$LOAD_PATHdirectory is. π§-Uβ same asruby -U. sets the default value for internal encodings (Encoding.default_internal) toUTF-8. slay.-dβ same asruby -d. sets$DEBUGtotrue.-fβ suppresses the read of~/.irbrc. like, don't look at my config, it's not ready π-wβ same asruby -w.-Wβ same asruby -W.-h--helpβ prints a summary of the options. for when you're lost but too proud to ask.-r libraryβ same asruby -r. causesirbto load the library usingrequire.--inspectβ usesinspectfor output. this is the default, except for bc mode.--noinspectβ doesn't useinspectfor 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 aredefault,simple,xmpandinf-ruby.--inf-ruby-modeβ uses a prompt that's appropriate forinf-ruby-modeon emacs. also suppresses--multilineand--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 topnand tailn. the default value is16.
π ENVIRONMENT π
IRBRC
also, irb depends on the same variables as ruby(1). iykyk.
π FILES π
~/.irbrcβ personalirbinitialization. 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 π
π 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
- ubuntu jammy: ruby3.0 3.0.2-7ubuntu2 Β· BSD-2-Clause OR Ruby
- ubuntu jammy: ruby3.0 3.0.2-7ubuntu2.13 Β· 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