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]autocomplete] [--[no]verbose] [--prompt mode]
11 [--prompt-mode mode] [--inf-ruby-mode] [--simple-prompt] [--noprompt]
12 [--tracer] [--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 --extra-doc-dir
62 Add an extra doc dir for the doc dialog.
63
64 --echo Show result (default).
65
66 --noecho Don't show result.
67
68 --echo-on-assignment
69 Show result on assignment.
70
71 --noecho-on-assignment
72 Don't show result on assignment.
73
74 --truncate-echo-on-assignment
75 Show truncated result on assignment (default).
76
77 --colorize Use colorization.
78
79 --nocolorize Don't use colorization.
80
81 --autocomplete
82 Use autocompletion.
83
84 --noautocomplete
85 Don't use autocompletion.
86
87 --verbose Show details.
88
89 --noverbose Don't show details.
90
91 --prompt mode
92 --prompt-mode mode
93 Switch prompt mode. Pre-defined prompt modes are `de‐
94 fault', `simple', `xmp' and `inf-ruby'.
95
96 --inf-ruby-mode
97 Uses prompt appropriate for inf-ruby-mode on emacs. Sup‐
98 presses --multiline and --singleline.
99
100 --simple-prompt
101 Makes prompts simple.
102
103 --noprompt No prompt mode.
104
105 --tracer Displays trace for each execution of commands.
106
107 --back-trace-limit n
108 Displays backtrace top n and tail n. The default value is
109 16.
110
112 IRB_LANG The locale used for irb.
113
114 IRBRC The path to the personal initialization file.
115
116 XDG_CONFIG_HOME irb respects XDG_CONFIG_HOME. If this is set, load
117 $XDG_CONFIG_HOME/irb/irbrc as a personal initialization
118 file.
119
120 Also irb depends on same variables as ruby(1).
121
123 ~/.irbrc
124 Personal irb initialization. If IRBRC is set, read $IRBRC in‐
125 stead. If IRBRC is not set and XDG_CONFIG_HOME is set,
126 $XDG_CONFIG_HOME/irb/irbrc is loaded.
127
129 % irb
130 irb(main):001:0> 1 + 1
131 2
132 irb(main):002:0> def t(x)
133 irb(main):003:1> x + 1
134 irb(main):004:1> end
135 => :t
136 irb(main):005:0> t(3)
137 => 4
138 irb(main):006:0> if t(3) == 4
139 irb(main):007:1> p :ok
140 irb(main):008:1> end
141 :ok
142 => :ok
143 irb(main):009:0> quit
144 %
145
147 ruby(1).
148
150 • Security vulnerabilities should be reported via an email to
151 security@ruby-lang.org. Reported problems will be published after
152 being fixed.
153
154 • Other bugs and feature requests can be reported via the Ruby Issue
155 Tracking System (https://bugs.ruby-lang.org/). Do not report security
156 vulnerabilities via this system because it publishes the vulnerabili‐
157 ties immediately.
158
160 Written by Keiju ISHITSUKA.
161
162UNIX August 11, 2019 UNIX