1IRB(1) Ruby Programmers Reference Guide IRB(1)
2
4 irb — Interactive Ruby Shell
5
7 irb [--version] [-dfm] [-I directory] [-r library] [--[no]inspect]
8 [--[no]readline] [--prompt mode] [--prompt-mode mode]
9 [--inf-ruby-mode] [--simple-prompt] [--noprompt] [--tracer]
10 [--back-trace-limit n] [--irb_debug n] [--] [program_file]
11 [argument ...]
12
14 irb is the REPL(read-eval-print loop) environment for Ruby programs.
15
17 --version Prints the version of irb.
18
19 -E external[:internal]
20 --encoding external[:internal]
21 Same as `ruby -E' . Specifies the default value(s) for
22 external encodings and internal encoding. Values should be
23 separated with colon (:).
24
25 You can omit the one for internal encodings, then the
26 value (Encoding.default_internal) will be nil.
27
28 -I path Same as `ruby -I' . Specifies $LOAD_PATH directory
29
30 -U Same as `ruby -U' . Sets the default value for internal
31 encodings (Encoding.default_internal) to UTF-8.
32
33 -d Same as `ruby -d' . Sets $DEBUG to true.
34
35 -f Suppresses read of ~/.irbrc.
36
37 -h
38 --help Prints a summary of the options.
39
40 -m Bc mode (load mathn, fraction or matrix are available)
41
42 -r library Same as `ruby -r'. Causes irb to load the library using
43 require.
44
45 --inspect Uses `inspect' for output (default except for bc mode)
46
47 --noinspect Doesn't use inspect for output
48
49 --readline Uses Readline extension module.
50
51 --noreadline Doesn't use Readline extension module.
52
53 --prompt mode
54 --prompt-mode mode
55 Switch prompt mode. Pre-defined prompt modes are
56 `default', `simple', `xmp' and `inf-ruby'.
57
58 --inf-ruby-mode
59 Uses prompt appropriate for inf-ruby-mode on emacs. Sup‐
60 presses --readline.
61
62 --simple-prompt
63 Makes prompts simple.
64
65 --noprompt No prompt mode.
66
67 --tracer Displays trace for each execution of commands.
68
69 --back-trace-limit n
70 Displays backtrace top n and tail n. The default value is
71 16.
72
73 --irb_debug n Sets internal debug level to n (not for popular use)
74
76 IRBRC
77
78 Also irb depends on same variables as ruby(1).
79
81 ~/.irbrc Personal irb initialization.
82
84 % irb
85 irb(main):001:0> 1 + 1
86 2
87 irb(main):002:0> def t(x)
88 irb(main):003:1> x+1
89 irb(main):004:1> end
90 => nil
91 irb(main):005:0> t(3)
92 => 4
93 irb(main):006:0> if t(3) == 4
94 irb(main):007:1> p :ok
95 irb(main):008:1> end
96 :ok
97 => :ok
98 irb(main):009:0> quit
99 %
100
102 ruby(1).
103
105 Security vulnerabilities should be reported via an email to
106 ⟨security@ruby-lang.org⟩. Reported problems will be published after
107 being fixed.
108
109 And you can report other bugs and feature requests via the Ruby Issue
110 Tracking System (http://bugs.ruby-lang.org). Do not report security vul‐
111 nerabilities via the system because it publishes the vulnerabilities
112 immediately.
113
115 Written by Keiju ISHITSUKA.
116
117UNIX November 7, 2012 UNIX