1IRB(1) Ruby Programmer's Reference Guide IRB(1)
2
4 irb — Interactive Ruby Shell
5
7 irb [--version] [-dfUw] [-I directory] [-r library]
8 [-E external[:internal]] [-W[level]] [--[no]inspect]
9 [--[no]multiline] [--[no]singleline] [--[no]echo] [--[no]colorize]
10 [--[no]verbose] [--prompt mode] [--prompt-mode mode]
11 [--inf-ruby-mode] [--simple-prompt] [--noprompt] [--tracer]
12 [--back-trace-limit n] [--] [program_file] [argument ...]
13
15 irb is the REPL(read-eval-print loop) environment for Ruby programs.
16
18 --version Prints the version of irb.
19
20 -E external[:internal]
21 --encoding external[:internal]
22 Same as `ruby -E' . Specifies the default value(s) for
23 external encodings and internal encoding. Values should be
24 separated with colon (:).
25
26 You can omit the one for internal encodings, then the
27 value (Encoding.default_internal) will be nil.
28
29 -I path Same as `ruby -I' . Specifies $LOAD_PATH directory
30
31 -U Same as `ruby -U' . Sets the default value for internal
32 encodings (Encoding.default_internal) to UTF-8.
33
34 -d Same as `ruby -d' . Sets $DEBUG to true.
35
36 -f Suppresses read of ~/.irbrc.
37
38 -w Same as `ruby -w' .
39
40 -W Same as `ruby -W' .
41
42 -h
43 --help Prints a summary of the options.
44
45 -r library Same as `ruby -r'. Causes irb to load the library using
46 require.
47
48 --inspect Uses `inspect' for output (default except for bc mode)
49
50 --noinspect Doesn't use inspect for output
51
52 --multiline Uses multiline editor module.
53
54 --nomultiline Doesn't use multiline editor module.
55
56 --singleline Uses singleline editor module.
57
58 --nosingleline
59 Doesn't use singleline editor module.
60
61 --echo Show result(default).
62
63 --noecho Don't show result.
64
65 --colorize Use colorization.
66
67 --nocolorize Don't use colorization.
68
69 --verbose Show details.
70
71 --noverbose Don't show details.
72
73 --prompt mode
74 --prompt-mode mode
75 Switch prompt mode. Pre-defined prompt modes are
76 `default', `simple', `xmp' and `inf-ruby'.
77
78 --inf-ruby-mode
79 Uses prompt appropriate for inf-ruby-mode on emacs. Sup‐
80 presses --multiline and --singleline.
81
82 --simple-prompt
83 Makes prompts simple.
84
85 --noprompt No prompt mode.
86
87 --tracer Displays trace for each execution of commands.
88
89 --back-trace-limit n
90 Displays backtrace top n and tail n. The default value is
91 16.
92
94 IRBRC
95
96 Also irb depends on same variables as ruby(1).
97
99 ~/.irbrc Personal irb initialization.
100
102 % irb
103 irb(main):001:0> 1 + 1
104 2
105 irb(main):002:0> def t(x)
106 irb(main):003:1> x + 1
107 irb(main):004:1> end
108 => :t
109 irb(main):005:0> t(3)
110 => 4
111 irb(main):006:0> if t(3) == 4
112 irb(main):007:1> p :ok
113 irb(main):008:1> end
114 :ok
115 => :ok
116 irb(main):009:0> quit
117 %
118
120 ruby(1).
121
123 · Security vulnerabilities should be reported via an email to
124 security@ruby-lang.org. Reported problems will be published after
125 being fixed.
126
127 · Other bugs and feature requests can be reported via the Ruby Issue
128 Tracking System (https://bugs.ruby-lang.org/). Do not report secu‐
129 rity vulnerabilities via this system because it publishes the vulner‐
130 abilities immediately.
131
133 Written by Keiju ISHITSUKA.
134
135UNIX August 11, 2019 UNIX