2008-10-25 20:44:13 +04:00
|
|
|
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
|
2019-08-11 18:11:34 +03:00
|
|
|
.Dd August 11, 2019
|
2017-04-20 10:46:22 +03:00
|
|
|
.Dt IRB \&1 "Ruby Programmer's Reference Guide"
|
2008-10-25 20:44:13 +04:00
|
|
|
.Os UNIX
|
|
|
|
.Sh NAME
|
|
|
|
.Nm irb
|
|
|
|
.Nd Interactive Ruby Shell
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl -version
|
2019-08-11 18:11:34 +03:00
|
|
|
.Op Fl dfUw
|
2008-12-27 07:12:38 +03:00
|
|
|
.Op Fl I Ar directory
|
|
|
|
.Op Fl r Ar library
|
2019-08-11 18:11:34 +03:00
|
|
|
.Op Fl E Ar external Ns Op : Ns Ar internal
|
|
|
|
.Op Fl W Ns Op Ar level
|
2008-10-25 20:44:13 +04:00
|
|
|
.Op Fl - Ns Oo no Oc Ns inspect
|
2019-10-30 03:32:16 +03:00
|
|
|
.Op Fl - Ns Oo no Oc Ns multiline
|
|
|
|
.Op Fl - Ns Oo no Oc Ns singleline
|
2019-08-11 18:11:34 +03:00
|
|
|
.Op Fl - Ns Oo no Oc Ns echo
|
|
|
|
.Op Fl - Ns Oo no Oc Ns colorize
|
2021-08-29 20:08:16 +03:00
|
|
|
.Op Fl - Ns Oo no Oc Ns autocomplete
|
2019-08-11 18:11:34 +03:00
|
|
|
.Op Fl - Ns Oo no Oc Ns verbose
|
2008-10-25 20:44:13 +04:00
|
|
|
.Op Fl -prompt Ar mode
|
|
|
|
.Op Fl -prompt-mode Ar mode
|
|
|
|
.Op Fl -inf-ruby-mode
|
|
|
|
.Op Fl -simple-prompt
|
|
|
|
.Op Fl -noprompt
|
|
|
|
.Op Fl -tracer
|
|
|
|
.Op Fl -back-trace-limit Ar n
|
|
|
|
.Op Fl -
|
|
|
|
.Op program_file
|
|
|
|
.Op argument ...
|
|
|
|
.Pp
|
|
|
|
.Sh DESCRIPTION
|
2008-12-27 07:12:38 +03:00
|
|
|
.Nm
|
2012-11-15 08:22:44 +04:00
|
|
|
is the REPL(read-eval-print loop) environment for Ruby programs.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width "1234567890123" -compact
|
|
|
|
.Pp
|
2008-12-27 07:12:38 +03:00
|
|
|
.It Fl -version
|
|
|
|
Prints the version of
|
|
|
|
.Nm .
|
|
|
|
.Pp
|
|
|
|
.It Fl E Ar external Ns Op : Ns Ar internal
|
|
|
|
.It Fl -encoding Ar external Ns Op : Ns Ar internal
|
|
|
|
Same as `ruby -E' .
|
|
|
|
Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:).
|
2009-10-26 09:44:31 +03:00
|
|
|
.Pp
|
2010-12-01 14:07:03 +03:00
|
|
|
You can omit the one for internal encodings, then the value
|
2008-12-27 07:12:38 +03:00
|
|
|
.Pf ( Li "Encoding.default_internal" ) will be nil.
|
|
|
|
.Pp
|
|
|
|
.It Fl I Ar path
|
|
|
|
Same as `ruby -I' .
|
|
|
|
Specifies
|
|
|
|
.Li $LOAD_PATH
|
|
|
|
directory
|
|
|
|
.Pp
|
|
|
|
.It Fl U
|
|
|
|
Same as `ruby -U' .
|
2010-12-01 14:07:03 +03:00
|
|
|
Sets the default value for internal encodings
|
2008-12-27 07:12:38 +03:00
|
|
|
.Pf ( Li "Encoding.default_internal" ) to UTF-8.
|
|
|
|
.Pp
|
2008-10-25 20:44:13 +04:00
|
|
|
.It Fl d
|
2008-12-27 07:12:38 +03:00
|
|
|
Same as `ruby -d' .
|
2008-10-25 20:44:13 +04:00
|
|
|
Sets
|
|
|
|
.Li $DEBUG
|
2008-12-27 07:12:38 +03:00
|
|
|
to true.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
|
|
|
.It Fl f
|
2009-10-26 09:44:31 +03:00
|
|
|
Suppresses read of
|
2008-12-27 07:12:38 +03:00
|
|
|
.Pa ~/.irbrc .
|
|
|
|
.Pp
|
2019-08-11 18:11:34 +03:00
|
|
|
.It Fl w
|
|
|
|
Same as `ruby -w' .
|
|
|
|
.Pp
|
|
|
|
.Pp
|
|
|
|
.It Fl W
|
|
|
|
Same as `ruby -W' .
|
|
|
|
.Pp
|
2008-12-27 07:12:38 +03:00
|
|
|
.It Fl h
|
|
|
|
.It Fl -help
|
|
|
|
Prints a summary of the options.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
2008-12-27 07:12:38 +03:00
|
|
|
.It Fl r Ar library
|
|
|
|
Same as `ruby -r'.
|
|
|
|
Causes irb to load the library using require.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
|
|
|
.It Fl -inspect
|
|
|
|
Uses `inspect' for output (default except for bc mode)
|
|
|
|
.Pp
|
|
|
|
.It Fl -noinspect
|
|
|
|
Doesn't use inspect for output
|
|
|
|
.Pp
|
2019-10-30 03:32:16 +03:00
|
|
|
.It Fl -multiline
|
|
|
|
Uses multiline editor module.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
2019-10-30 03:32:16 +03:00
|
|
|
.It Fl -nomultiline
|
|
|
|
Doesn't use multiline editor module.
|
|
|
|
.Pp
|
|
|
|
.It Fl -singleline
|
|
|
|
Uses singleline editor module.
|
|
|
|
.Pp
|
|
|
|
.It Fl -nosingleline
|
|
|
|
Doesn't use singleline editor module.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
2019-08-11 18:11:34 +03:00
|
|
|
.Pp
|
2021-10-11 14:40:44 +03:00
|
|
|
.It Fl -extra-doc-dir
|
|
|
|
Add an extra doc dir for the doc dialog.
|
|
|
|
.Pp
|
|
|
|
.Pp
|
2019-08-11 18:11:34 +03:00
|
|
|
.It Fl -echo
|
2021-09-26 21:03:20 +03:00
|
|
|
Show result (default).
|
2019-08-11 18:11:34 +03:00
|
|
|
.Pp
|
|
|
|
.It Fl -noecho
|
|
|
|
Don't show result.
|
|
|
|
.Pp
|
|
|
|
.Pp
|
2021-09-26 21:21:39 +03:00
|
|
|
.It Fl -echo-on-assignment
|
|
|
|
Show result on assignment.
|
|
|
|
.Pp
|
|
|
|
.It Fl -noecho-on-assignment
|
|
|
|
Don't show result on assignment.
|
|
|
|
.Pp
|
|
|
|
.It Fl -truncate-echo-on-assignment
|
|
|
|
Show truncated result on assignment (default).
|
|
|
|
.Pp
|
|
|
|
.Pp
|
2019-08-11 18:11:34 +03:00
|
|
|
.It Fl -colorize
|
|
|
|
Use colorization.
|
|
|
|
.Pp
|
|
|
|
.It Fl -nocolorize
|
|
|
|
Don't use colorization.
|
|
|
|
.Pp
|
|
|
|
.Pp
|
2021-08-29 20:08:16 +03:00
|
|
|
.It Fl -autocomplete
|
|
|
|
Use autocompletion.
|
|
|
|
.Pp
|
|
|
|
.It Fl -noautocomplete
|
|
|
|
Don't use autocompletion.
|
|
|
|
.Pp
|
|
|
|
.Pp
|
2019-08-11 18:11:34 +03:00
|
|
|
.It Fl -verbose
|
|
|
|
Show details.
|
|
|
|
.Pp
|
|
|
|
.It Fl -noverbose
|
|
|
|
Don't show details.
|
|
|
|
.Pp
|
2008-10-25 20:44:13 +04:00
|
|
|
.It Fl -prompt Ar mode
|
|
|
|
.It Fl -prompt-mode Ar mode
|
|
|
|
Switch prompt mode. Pre-defined prompt modes are
|
|
|
|
`default', `simple', `xmp' and `inf-ruby'.
|
|
|
|
.Pp
|
2009-10-26 09:44:31 +03:00
|
|
|
.It Fl -inf-ruby-mode
|
|
|
|
Uses prompt appropriate for inf-ruby-mode on emacs.
|
2019-10-30 03:32:16 +03:00
|
|
|
Suppresses --multiline and --singleline.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
|
|
|
.It Fl -simple-prompt
|
|
|
|
Makes prompts simple.
|
|
|
|
.Pp
|
|
|
|
.It Fl -noprompt
|
|
|
|
No prompt mode.
|
|
|
|
.Pp
|
|
|
|
.It Fl -tracer
|
|
|
|
Displays trace for each execution of commands.
|
|
|
|
.Pp
|
|
|
|
.It Fl -back-trace-limit Ar n
|
|
|
|
Displays backtrace top
|
|
|
|
.Ar n
|
|
|
|
and tail
|
|
|
|
.Ar n Ns .
|
2009-10-26 09:44:31 +03:00
|
|
|
The default value is 16.
|
2008-10-25 20:44:13 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
.Sh ENVIRONMENT
|
2022-05-18 05:21:24 +03:00
|
|
|
.Bl -tag -compact -width "XDG_CONFIG_HOME"
|
|
|
|
.It Ev IRB_LANG
|
|
|
|
The locale used for
|
|
|
|
.Nm .
|
|
|
|
.Pp
|
2008-10-25 20:44:13 +04:00
|
|
|
.It Ev IRBRC
|
2022-05-18 05:21:24 +03:00
|
|
|
The path to the personal initialization file.
|
|
|
|
.Pp
|
|
|
|
.It Ev XDG_CONFIG_HOME
|
|
|
|
.Nm
|
|
|
|
respects XDG_CONFIG_HOME. If this is set, load
|
|
|
|
.Pa $XDG_CONFIG_HOME/irb/irbrc
|
|
|
|
as a personal initialization file.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Also
|
|
|
|
.Nm
|
|
|
|
depends on same variables as
|
|
|
|
.Xr ruby 1 .
|
|
|
|
.Pp
|
|
|
|
.Sh FILES
|
2016-08-22 08:35:59 +03:00
|
|
|
.Bl -tag -compact
|
2008-10-25 20:44:13 +04:00
|
|
|
.It Pa ~/.irbrc
|
2022-05-18 05:21:24 +03:00
|
|
|
Personal irb initialization. If
|
|
|
|
.Ev IRBRC
|
|
|
|
is set, read
|
|
|
|
.Pa $IRBRC
|
|
|
|
instead. If
|
|
|
|
.Ev IRBRC
|
|
|
|
is not set and
|
|
|
|
.Ev XDG_CONFIG_HOME
|
|
|
|
is set,
|
|
|
|
.Pa $XDG_CONFIG_HOME/irb/irbrc
|
|
|
|
is loaded.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
|
|
|
.El
|
|
|
|
.Pp
|
2008-11-29 18:00:48 +03:00
|
|
|
.Sh EXAMPLES
|
|
|
|
.Dl % irb
|
|
|
|
.Dl irb(main):001:0> Ic 1 + 1
|
|
|
|
.Dl 2
|
|
|
|
.Dl irb(main):002:0> Ic def t(x)
|
2019-08-11 18:11:34 +03:00
|
|
|
.Dl irb(main):003:1> Ic x + 1
|
2008-11-29 18:00:48 +03:00
|
|
|
.Dl irb(main):004:1> Ic end
|
2016-02-18 15:33:48 +03:00
|
|
|
.Dl => :t
|
2008-11-29 18:00:48 +03:00
|
|
|
.Dl irb(main):005:0> Ic t(3)
|
|
|
|
.Dl => 4
|
|
|
|
.Dl irb(main):006:0> Ic if t(3) == 4
|
|
|
|
.Dl irb(main):007:1> Ic p :ok
|
|
|
|
.Dl irb(main):008:1> Ic end
|
|
|
|
.Dl :ok
|
|
|
|
.Dl => :ok
|
|
|
|
.Dl irb(main):009:0> Ic quit
|
2009-10-26 09:44:31 +03:00
|
|
|
.Dl %
|
2008-11-29 18:00:48 +03:00
|
|
|
.Pp
|
2008-10-25 20:44:13 +04:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ruby 1 .
|
|
|
|
.Pp
|
|
|
|
.Sh REPORTING BUGS
|
|
|
|
.Bl -bullet
|
2017-04-20 10:46:22 +03:00
|
|
|
.It
|
|
|
|
Security vulnerabilities should be reported via an email to
|
|
|
|
.Mt security@ruby-lang.org .
|
2012-11-15 08:22:44 +04:00
|
|
|
Reported problems will be published after being fixed.
|
2008-10-25 20:44:13 +04:00
|
|
|
.Pp
|
2017-04-20 10:46:22 +03:00
|
|
|
.It
|
|
|
|
Other bugs and feature requests can be reported via the
|
2016-09-23 14:21:52 +03:00
|
|
|
Ruby Issue Tracking System
|
|
|
|
.Pq Lk https://bugs.ruby-lang.org/ .
|
2008-10-25 20:44:13 +04:00
|
|
|
Do not report security vulnerabilities
|
2017-04-20 10:46:22 +03:00
|
|
|
via this system because it publishes the vulnerabilities immediately.
|
2008-10-25 20:44:13 +04:00
|
|
|
.El
|
|
|
|
.Sh AUTHORS
|
|
|
|
Written by Keiju ISHITSUKA.
|