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 IRBRC
113
114 Also irb depends on same variables as ruby(1).
115
117 ~/.irbrc
118 Personal irb initialization.
119
121 % irb
122 irb(main):001:0> 1 + 1
123 2
124 irb(main):002:0> def t(x)
125 irb(main):003:1> x + 1
126 irb(main):004:1> end
127 => :t
128 irb(main):005:0> t(3)
129 => 4
130 irb(main):006:0> if t(3) == 4
131 irb(main):007:1> p :ok
132 irb(main):008:1> end
133 :ok
134 => :ok
135 irb(main):009:0> quit
136 %
137
139 ruby(1).
140
142 • Security vulnerabilities should be reported via an email to
143 security@ruby-lang.org. Reported problems will be published after
144 being fixed.
145
146 • Other bugs and feature requests can be reported via the Ruby Issue
147 Tracking System (https://bugs.ruby-lang.org/). Do not report security
148 vulnerabilities via this system because it publishes the vulnerabili‐
149 ties immediately.
150
152 Written by Keiju ISHITSUKA.
153
154UNIX August 11, 2019 UNIX