IRB
suggest changeIntroduction
IRB means “Interactive Ruby Shell”. It lets you execute Ruby commands in real time (like a normal shell).
IRB is useful when exploring the Ruby API. Use it for short commands.
Pressing Tab while typing a method lists possible completions.
Parameters
The options below are from an older IRB. Current IRB has no -m (bc mode; mathn is gone) and adds flags such as --echo and --autocomplete. -d also sets $VERBOSE. Run irb --help for the installed version.
| Option | Details |
|---|---|
-f |
Suppress reading ~/.irbrc. |
-m |
Bc mode (load mathn; fraction or matrix are available). |
-d |
Set $DEBUG to true (same as ruby -d). |
-r load-module |
Same as ruby -r. |
-I path |
Specify a $LOAD_PATH directory. |
-U |
Same as ruby -U. |
-E enc |
Same as ruby -E. |
-w |
Same as ruby -w. |
-W[level=2] |
Same as ruby -W. |
--inspect |
Use inspect for output (default except for bc mode). |
--noinspect |
Don't use inspect for output. |
--readline |
Use the Readline extension module. |
--noreadline |
Don't use the Readline extension module. |
--prompt prompt-mode |
Switch prompt mode. Pre-defined modes are default, simple, xmp, and inf-ruby. |
--inf-ruby-mode |
Use a prompt appropriate for inf-ruby-mode in Emacs. Suppresses --readline. |
--simple-prompt |
Simple prompt mode. |
--noprompt |
No prompt mode. |
--tracer |
Display a trace for each command. |
--back-trace-limit n |
Display the top n and tail n of the backtrace. The default is 16. |
--irb_debug n |
Set the internal debug level to n (not for popular use). |
-v, --version |
Print the version of irb. |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents