Offset 1, 738 lines modifiedOffset 1, 840 lines modified
1 .\"Ruby·is·copyrighted·by·Yukihiro·Matsumoto·<matz@netlab.jp>. 
2 .Dd·April·14,·2018 
3 .Dt·RUBY·\&1·"Ruby·Programmer's·Reference·Guide"1 .TH·RUBY·\&1·"Ruby·Programmer's·Reference·Guide"·"April·14,·2018"·"UNIX"
4 .Os·UNIX 
5 .Sh·NAME2 .SH·NAME
6 .Nm·ruby3 \fBruby\fP
7 .Nd·Interpreted·object-oriented·scripting·language4 \-·Interpreted·object-oriented·scripting·language
8 .Sh·SYNOPSIS5 .SH·SYNOPSIS
9 .Nm 
10 .Op·Fl·-copyright 
11 .Op·Fl·-version 
12 .Op·Fl·SUacdlnpswvy 
13 .Op·Fl·0·Ns·Op·Ar·octal 
14 .Op·Fl·C·Ar·directory 
15 .Op·Fl·E·Ar·external·Ns·Op·:·Ns·Ar·internal 
16 .Op·Fl·F·Ns·Op·Ar·pattern 
17 .Op·Fl·I·Ar·directory 
18 .Op·Fl·K·Ns·Op·Ar·c 
19 .Op·Fl·T·Ns·Op·Ar·level 
20 .Op·Fl·W·Ns·Op·Ar·level 
21 .Op·Fl·e·Ar·command 
22 .Op·Fl·i·Ns·Op·Ar·extension 
23 .Op·Fl·r·Ar·library 
24 .Op·Fl·x·Ns·Op·Ar·directory 
25 .Op·Fl·-·Ns·Bro·Cm·enable·Ns·|·Ns·Cm·disable·Brc·Ns·-·Ns·Ar·FEATURE 
26 .Op·Fl·-dump·Ns·=·Ns·Ar·target 
27 .Op·Fl·-verbose 
28 .Op·Fl·-crash-report·Ns·=·Ns·Ar·template 
29 .Op·Fl·- 
30 .Op·Ar·program_file 
31 .Op·Ar·argument·...6 .br
 7 \fBruby\fP
 8 [\fB\--copyright\fP]
 9 [\fB\--version\fP]
 10 [\fB\-SUacdlnpswvy\fP]
 11 [\fB\-0\fP[\fIoctal\fP]]
 12 [\fB\-C\fP·\fIdirectory\fP]
 13 [\fB\-E\fP·\fIexternal\fP[:\fIinternal\fP]]
 14 [\fB\-F\fP[\fIpattern\fP]]
 15 [\fB\-I\fP·\fIdirectory\fP]
 16 [\fB\-K\fP[\fIc\fP]]
 17 [\fB\-T\fP[\fIlevel\fP]]
 18 [\fB\-W\fP[\fIlevel\fP]]
 19 [\fB\-e\fP·\fIcommand\fP]
 20 [\fB\-i\fP[\fIextension\fP]]
 21 [\fB\-r\fP·\fIlibrary\fP]
 22 [\fB\-x\fP[\fIdirectory\fP]]
 23 [\fB\--\fP{\fBenable\fP|\fBdisable\fP}-\fIFEATURE\fP]
 24 [\fB\--dump\fP=\fItarget\fP]
 25 [\fB\--verbose\fP]
 26 [\fB\--crash-report\fP=\fItemplate\fP]
 27 [\fB\--\fP]
 28 [\fIprogram_file\fP]
 29 [\fIargument\fP·...]
32 .Sh·DESCRIPTION30 .SH·DESCRIPTION
33 Ruby·is·an·interpreted·scripting·language·for·quick·and·easy31 Ruby·is·an·interpreted·scripting·language·for·quick·and·easy
34 object-oriented·programming.··It·has·many·features·to·process·text32 object-oriented·programming.··It·has·many·features·to·process·text
35 files·and·to·do·system·management·tasks·(like·in·Perl).··It·is·simple,33 files·and·to·do·system·management·tasks·(like·in·Perl).··It·is·simple,
36 straight-forward,·and·extensible.34 straight-forward,·and·extensible.
37 .Pp 
38 If·you·want·a·language·for·easy·object-oriented·programming,·or·you35 If·you·want·a·language·for·easy·object-oriented·programming,·or·you
39 don't·like·the·Perl·ugliness,·or·you·do·like·the·concept·of·LISP,·but36 don't·like·the·Perl·ugliness,·or·you·do·like·the·concept·of·LISP,·but
40 don't·like·too·many·parentheses,·Ruby·might·be·your·language·of37 don't·like·too·many·parentheses,·Ruby·might·be·your·language·of
41 choice.38 choice.
42 .Sh·FEATURES39 .SH·FEATURES
43 Ruby's·features·are·as·follows:40 Ruby's·features·are·as·follows:
44 .Bl·-tag·-width·6n41 .TP
45 .It·Sy·"Interpretive"42 .B·"Interpretive"
46 Ruby·is·an·interpreted·language,·so·you·don't·have·to·recompile43 Ruby·is·an·interpreted·language,·so·you·don't·have·to·recompile
47 programs·written·in·Ruby·to·execute·them.44 programs·written·in·Ruby·to·execute·them.
48 .Pp 
 45 .TP
49 .It·Sy·"Variables·have·no·type·(dynamic·typing)"46 .B·"Variables·have·no·type·(dynamic·typing)"
50 Variables·in·Ruby·can·contain·data·of·any·type.··You·don't·have·to47 Variables·in·Ruby·can·contain·data·of·any·type.··You·don't·have·to
51 worry·about·variable·typing.··Consequently,·it·has·a·weaker·compile48 worry·about·variable·typing.··Consequently,·it·has·a·weaker·compile
52 time·check.49 time·check.
53 .Pp 
 50 .TP
54 .It·Sy·"No·declaration·needed"51 .B·"No·declaration·needed"
55 You·can·use·variables·in·your·Ruby·programs·without·any·declarations.52 You·can·use·variables·in·your·Ruby·programs·without·any·declarations.
56 Variable·names·denote·their·scope·-·global,·class,·instance,·or·local.53 Variable·names·denote·their·scope·-·global,·class,·instance,·or·local.
57 .Pp 
 54 .TP
58 .It·Sy·"Simple·syntax"55 .B·"Simple·syntax"
59 Ruby·has·a·simple·syntax·influenced·slightly·from·Eiffel.56 Ruby·has·a·simple·syntax·influenced·slightly·from·Eiffel.
60 .Pp 
 57 .TP
61 .It·Sy·"No·user-level·memory·management"58 .B·"No·user-level·memory·management"
62 Ruby·has·automatic·memory·management.··Objects·no·longer·referenced59 Ruby·has·automatic·memory·management.··Objects·no·longer·referenced
63 from·anywhere·are·automatically·collected·by·the·garbage·collector60 from·anywhere·are·automatically·collected·by·the·garbage·collector
64 built·into·the·interpreter.61 built·into·the·interpreter.
65 .Pp 
 62 .TP
66 .It·Sy·"Everything·is·an·object"63 .B·"Everything·is·an·object"
67 Ruby·is·a·purely·object-oriented·language,·and·was·so·since·its64 Ruby·is·a·purely·object-oriented·language,·and·was·so·since·its
68 creation.··Even·such·basic·data·as·integers·are·seen·as·objects.65 creation.··Even·such·basic·data·as·integers·are·seen·as·objects.
69 .Pp 
 66 .TP
70 .It·Sy·"Class,·inheritance,·and·methods"67 .B·"Class,·inheritance,·and·methods"
71 Being·an·object-oriented·language,·Ruby·naturally·has·basic68 Being·an·object-oriented·language,·Ruby·naturally·has·basic
72 features·like·classes,·inheritance,·and·methods.69 features·like·classes,·inheritance,·and·methods.
73 .Pp 
 70 .TP
74 .It·Sy·"Singleton·methods"71 .B·"Singleton·methods"
75 Ruby·has·the·ability·to·define·methods·for·certain·objects.··For72 Ruby·has·the·ability·to·define·methods·for·certain·objects.··For
76 example,·you·can·define·a·press-button·action·for·certain·widget·by73 example,·you·can·define·a·press-button·action·for·certain·widget·by
77 defining·a·singleton·method·for·the·button.··Or,·you·can·make·up·your74 defining·a·singleton·method·for·the·button.··Or,·you·can·make·up·your
78 own·prototype·based·object·system·using·singleton·methods,·if·you·want75 own·prototype·based·object·system·using·singleton·methods,·if·you·want
79 to.76 to.
80 .Pp 
 77 .TP
81 .It·Sy·"Mix-in·by·modules"78 .B·"Mix-in·by·modules"
82 Ruby·intentionally·does·not·have·the·multiple·inheritance·as·it·is·a79 Ruby·intentionally·does·not·have·the·multiple·inheritance·as·it·is·a
83 source·of·confusion.··Instead,·Ruby·has·the·ability·to·share80 source·of·confusion.··Instead,·Ruby·has·the·ability·to·share
84 implementations·across·the·inheritance·tree.··This·is·often·called·a81 implementations·across·the·inheritance·tree.··This·is·often·called·a
85 .Sq·Mix-in·. 
86 .Pp82 `Mix-in'.
  
 83 .TP
87 .It·Sy·"Iterators"84 .B·"Iterators"
88 Ruby·has·iterators·for·loop·abstraction.85 Ruby·has·iterators·for·loop·abstraction.
89 .Pp 
 86 .TP
90 .It·Sy·"Closures"87 .B·"Closures"
91 In·Ruby,·you·can·objectify·the·procedure.88 In·Ruby,·you·can·objectify·the·procedure.
92 .Pp 
 89 .TP
93 .It·Sy·"Text·processing·and·regular·expressions"90 .B·"Text·processing·and·regular·expressions"
94 Ruby·has·a·bunch·of·text·processing·features·like·in·Perl.91 Ruby·has·a·bunch·of·text·processing·features·like·in·Perl.
95 .Pp 
 92 .TP
96 .It·Sy·"M17N,·character·set·independent"93 .B·"M17N,·character·set·independent"
97 Ruby·supports·multilingualized·programming.·Easy·to·process·texts94 Ruby·supports·multilingualized·programming.·Easy·to·process·texts
98 written·in·many·different·natural·languages·and·encoded·in·many95 written·in·many·different·natural·languages·and·encoded·in·many
99 different·character·encodings,·without·dependence·on·Unicode.96 different·character·encodings,·without·dependence·on·Unicode.
100 .Pp 
 97 .TP
101 .It·Sy·"Bignums"98 .B·"Bignums"
102 With·built-in·bignums,·you·can·for·example·calculate·factorial(400).99 With·built-in·bignums,·you·can·for·example·calculate·factorial(400).
103 .Pp 
 100 .TP
104 .It·Sy·"Reflection·and·domain·specific·languages"101 .B·"Reflection·and·domain·specific·languages"
105 Class·is·also·an·instance·of·the·Class·class.·Definition·of·classes·and·methods102 Class·is·also·an·instance·of·the·Class·class.·Definition·of·classes·and·methods
106 is·an·expression·just·as·1+1·is.·So·your·programs·can·even·write·and·modify·programs.103 is·an·expression·just·as·1+1·is.·So·your·programs·can·even·write·and·modify·programs.
107 Thus·you·can·write·your·application·in·your·own·programming·language·on·top·of·Ruby.104 Thus·you·can·write·your·application·in·your·own·programming·language·on·top·of·Ruby.
108 .Pp 
 105 .TP
109 .It·Sy·"Exception·handling"106 .B·"Exception·handling"
110 As·in·Java(tm).107 As·in·Java(tm).
111 .Pp 
 108 .TP
112 .It·Sy·"Direct·access·to·the·OS"109 .B·"Direct·access·to·the·OS"
113 Ruby·can·use·most110 Ruby·can·use·most
114 .Ux111 UNIX
115 system·calls,·often·used·in·system·programming.112 system·calls,·often·used·in·system·programming.
116 .Pp 
 113 .TP
117 .It·Sy·"Dynamic·loading"114 .B·"Dynamic·loading"
118 On·most115 On·most
119 .Ux116 UNIX
120 systems,·you·can·load·object·files·into·the·Ruby·interpreter117 systems,·you·can·load·object·files·into·the·Ruby·interpreter
121 on-the-fly.118 on-the-fly.
 119 .TP
122 .It·Sy·"Rich·libraries"120 .B·"Rich·libraries"
123 In·addition·to·the121 In·addition·to·the
124 .Dq·builtin·libraries122 ``builtin·libraries''
125 and123 and
126 .Dq·standard·libraries124 ``standard·libraries''
127 that·are·bundled·with·Ruby,·a·vast·amount·of·third-party·libraries125 that·are·bundled·with·Ruby,·a·vast·amount·of·third-party·libraries
128 .Pq·Dq·gems126 (``gems'')
129 are·available·via·the·package·management·system·called127 are·available·via·the·package·management·system·called
130 .Sq·RubyGems·,128 `RubyGems',
131 namely·the129 namely·the
132 .Xr·gem·1130 \fBgem\fP(1)
133 command.··Visit·RubyGems.org131 command.··Visit·RubyGems.org
134 .Pq·Lk·https://rubygems.org/132 (\fBhttps://rubygems.org/\fP)
135 to·find·the·gems·you·need,·and·explore·GitHub133 to·find·the·gems·you·need,·and·explore·GitHub
136 .Pq·Lk·https://github.com/134 (\fBhttps://github.com/\fP)
137 to·see·how·they·are·being·developed·and·used.135 to·see·how·they·are·being·developed·and·used.
  
138 .El 
139 .Pp 
140 .Sh·OPTIONS136 .SH·OPTIONS
141 The·Ruby·interpreter·accepts·the·following·command-line·options·(switches).137 The·Ruby·interpreter·accepts·the·following·command-line·options·(switches).
142 They·are·quite·similar·to·those·of138 They·are·quite·similar·to·those·of
143 .Xr·perl·1·. 
144 .Bl·-tag·-width·"1234567890123"·-compact 
145 .Pp 
146 .It·Fl·-copyright139 \fBperl\fP(1).
  
 140 .TP
 141 \fB\--copyright\fP
147 Prints·the·copyright·notice,·and·quits·immediately·without·running·any142 Prints·the·copyright·notice,·and·quits·immediately·without·running·any
148 script.143 script.
149 .Pp 
150 .It·Fl·-version 
 144 .TP
 145 \fB\--version\fP
151 Prints·the·version·of·the·Ruby·interpreter,·and·quits·immediately·without146 Prints·the·version·of·the·Ruby·interpreter,·and·quits·immediately·without
152 running·any·script.147 running·any·script.
153 .Pp 
154 .It·Fl·0·Ns·Op·Ar·octal 
 148 .TP
 149 \fB\-0\fP[\fIoctal\fP]
155 (The·digit150 (The·digit
156 .Dq·zero·.·)151 ``zero''.)
157 Specifies·the·input·record·separator152 Specifies·the·input·record·separator
158 .Pf·(·Li·"$/"·)153 ("$/")
159 as·an·octal·number.·If·no·digit·is·given,·the·null·character·is·taken154 as·an·octal·number.·If·no·digit·is·given,·the·null·character·is·taken
160 as·the·separator.··Other·switches·may·follow·the·digits.155 as·the·separator.··Other·switches·may·follow·the·digits.
161 .Fl·00156 \fB\-00\fP
162 turns·Ruby·into·paragraph·mode.157 turns·Ruby·into·paragraph·mode.
163 .Fl·0777158 \fB\-0777\fP
164 makes·Ruby·read·whole·file·at·once·as·a·single·string·since·there·is159 makes·Ruby·read·whole·file·at·once·as·a·single·string·since·there·is
165 no·legal·character·with·that·value.160 no·legal·character·with·that·value.
166 .Pp 
167 .It·Fl·C·Ar·directory 
168 .It·Fl·X·Ar·directory 
 161 .TP
 162 \fB\-C\fP·\fIdirectory\fP
 163 .TP
 164 \fB\-X\fP·\fIdirectory\fP
169 Causes·Ruby·to·switch·to·the·directory.165 Causes·Ruby·to·switch·to·the·directory.
170 .Pp 
171 .It·Fl·E·Ar·external·Ns·Op·:·Ns·Ar·internal 
172 .It·Fl·-encoding·Ar·external·Ns·Op·:·Ns·Ar·internal 
 166 .TP
 167 \fB\-E\fP·\fIexternal\fP[:\fIinternal\fP]
 168 .TP
 169 \fB\--encoding\fP·\fIexternal\fP[:\fIinternal\fP]
173 Specifies·the·default·value(s)·for·external·encodings·and·internal·encoding.·Values·should·be·separated·with·colon·(:).170 Specifies·the·default·value(s)·for·external·encodings·and·internal·encoding.·Values·should·be·separated·with·colon·(:).
174 .Pp 
175 You·can·omit·the·one·for·internal·encodings,·then·the·value171 You·can·omit·the·one·for·internal·encodings,·then·the·value
176 .Pf·(·Li·"Encoding.default_internal"·)·will·be·nil.172 ("Encoding.default_internal")·will·be·nil.
177 .Pp 
178 .It·Fl·-external-encoding·Ns·=·Ns·Ar·encoding 
179 .It·Fl·-internal-encoding·Ns·=·Ns·Ar·encoding 
 173 .TP
 174 \fB\--external-encoding\fP=\fIencoding\fP
 175 .TP
 176 \fB\--internal-encoding\fP=\fIencoding\fP
180 Specify·the·default·external·or·internal·character·encoding177 Specify·the·default·external·or·internal·character·encoding
181 .Pp 
182 .It·Fl·F·Ar·pattern 
 178 .TP
 179 \fB\-F\fP·\fIpattern\fP
183 Specifies·input·field·separator180 Specifies·input·field·separator
184 .Pf·(·Li·"$;"·)·. 
185 .Pp 
186 .It·Fl·I·Ar·directory181 ("$;").
  
 182 .TP
 183 \fB\-I\fP·\fIdirectory\fP
187 Used·to·tell·Ruby·where·to·load·the·library·scripts.··Directory·path184 Used·to·tell·Ruby·where·to·load·the·library·scripts.··Directory·path
188 will·be·added·to·the·load-path·variable185 will·be·added·to·the·load-path·variable
189 .Pf·(·Li·"$:"·)·. 
190 .Pp 
191 .It·Fl·K·Ar·kcode186 ("$:").
  
 187 .TP
 188 \fB\-K\fP·\fIkcode\fP
192 Specifies·KANJI·(Japanese)·encoding.·The·default·value·for·script·encodings189 Specifies·KANJI·(Japanese)·encoding.·The·default·value·for·script·encodings
193 .Pf·(·Li·"__ENCODING__"·)·and·external·encodings·(·Li·"Encoding.default_external"·)·will·be·the·specified·one.190 ("__ENCODING__")·and·external·encodings·("Encoding.default_external")·will·be·the·specified·one.
194 .Ar·kcode191 \fIkcode\fP
195 can·be·one·of192 can·be·one·of
196 .Bl·-hang·-offset·indent 
197 .It·Sy·e193 .TP
 194 .B·e
198 EUC-JP195 EUC-JP
199 .Pp 
200 .It·Sy·s 
 196 .TP
 197 .B·s
201 Windows-31J·(CP932)198 Windows-31J·(CP932)
202 .Pp 
203 .It·Sy·u 
 199 .TP
 200 .B·u
204 UTF-8201 UTF-8
205 .Pp 
206 .It·Sy·n 
 202 .TP
 203 .B·n
207 ASCII-8BIT·(BINARY)204 ASCII-8BIT·(BINARY)
208 .El 
209 .Pp 
210 .It·Fl·S 
 205 .TP
 206 \fB\-S\fP
211 Makes·Ruby·use·the207 Makes·Ruby·use·the
212 .Ev·PATH208 .IR·PATH
213 environment·variable·to·search·for·script,·unless·its·name·begins209 environment·variable·to·search·for·script,·unless·its·name·begins
214 with·a·slash.··This·is·used·to·emulate210 with·a·slash.··This·is·used·to·emulate
215 .Li·#!211 #!
216 on·machines·that·don't·support·it,·in·the·following·manner:212 on·machines·that·don't·support·it,·in·the·following·manner:
217 .Bd·-literal·-offset·indent 
218 #!·/usr/local/bin/ruby213 #!·/usr/local/bin/ruby
 214 .br
219 #·This·line·makes·the·next·one·a·comment·in·Ruby·\e215 #·This·line·makes·the·next·one·a·comment·in·Ruby·\e
 216 .br
220 ··exec·/usr/local/bin/ruby·-S·$0·$*217 ··exec·/usr/local/bin/ruby·-S·$0·$*
221 .Ed 
222 .Pp218 .br
  
223 On·some·systems219 On·some·systems
224 .Li·"$0"220 "$0"
225 does·not·always·contain·the·full·pathname,·so·you·need·the221 does·not·always·contain·the·full·pathname,·so·you·need·the
226 .Fl·S222 \fB\-S\fP
227 switch·to·tell·Ruby·to·search·for·the·script·if·necessary·(to·handle·embedded223 switch·to·tell·Ruby·to·search·for·the·script·if·necessary·(to·handle·embedded
228 spaces·and·such).··A·better·construct·than224 spaces·and·such).··A·better·construct·than
229 .Li·"$*"225 "$*"
230 would·be226 would·be
231 .Li·${1+"$@"}·,227 ${1+"$@"},
232 but·it·does·not·work·if·the·script·is·being·interpreted·by228 but·it·does·not·work·if·the·script·is·being·interpreted·by
233 .Xr·csh·1·. 
234 .Pp 
235 .It·Fl·T·Ns·Op·Ar·level=1229 \fBcsh\fP(1).
  
 230 .TP
 231 \fB\-T\fP[\fIlevel=1\fP]
236 Turns·on·taint·checks·at·the·specified·level·(default·1).232 Turns·on·taint·checks·at·the·specified·level·(default·1).
237 .Pp 
238 .It·Fl·U 
 233 .TP
 234 \fB\-U\fP
239 Sets·the·default·value·for·internal·encodings235 Sets·the·default·value·for·internal·encodings
240 .Pf·(·Li·"Encoding.default_internal"·)·to·UTF-8.236 ("Encoding.default_internal")·to·UTF-8.
241 .Pp 
242 .It·Fl·W·Ns·Op·Ar·level=2 
 237 .TP
 238 \fB\-W\fP[\fIlevel=2\fP]
243 Turns·on·verbose·mode·at·the·specified·level·without·printing·the·version239 Turns·on·verbose·mode·at·the·specified·level·without·printing·the·version
244 message·at·the·beginning.·The·level·can·be;240 message·at·the·beginning.·The·level·can·be;
245 .Bl·-hang·-offset·indent 
246 .It·Sy·0241 .TP
 242 .B·0
247 Verbose·mode·is·"silence".·It·sets·the243 Verbose·mode·is·"silence".·It·sets·the
248 .Li·"$VERBOSE"244 "$VERBOSE"
249 to·nil.245 to·nil.
250 .Pp 
251 .It·Sy·1 
 246 .TP
 247 .B·1
252 Verbose·mode·is·"medium".·It·sets·the248 Verbose·mode·is·"medium".·It·sets·the
253 .Li·"$VERBOSE"249 "$VERBOSE"
254 to·false.250 to·false.
255 .Pp 
 251 .TP
256 .It·Sy·2·(default)252 .B·2·(default)
257 Verbose·mode·is·"verbose".·It·sets·the253 Verbose·mode·is·"verbose".·It·sets·the
258 .Li·"$VERBOSE"254 "$VERBOSE"
259 to·true.255 to·true.
260 .Fl·W·Ns256 \fB\-W\fP
261 2·is·the·same·as257 2·is·the·same·as
 258 \fB\-w\fP
  
 259 .TP
 260 \fB\-a\fP
262 .Fl·w 
263 . 
264 .El 
265 .Pp 
266 .It·Fl·a 
267 Turns·on·auto-split·mode·when·used·with261 Turns·on·auto-split·mode·when·used·with
268 .Fl·n262 \fB\-n\fP
269 or263 or
270 .Fl·p·.264 \fB\-p\fP.
271 In·auto-split·mode,·Ruby·executes265 In·auto-split·mode,·Ruby·executes
 266 .nf
272 .Dl·$F·=·$_.split267 \&··$F·=·$_.split
 268 .fi
273 at·beginning·of·each·loop.269 at·beginning·of·each·loop.
274 .Pp 
275 .It·Fl·-backtrace-limit·Ns·=·Ns·Ar·num 
 270 .TP
 271 \fB\--backtrace-limit\fP=\fInum\fP
276 Limits·the·maximum·length·of·backtraces·to272 Limits·the·maximum·length·of·backtraces·to
277 .Ar·num273 \fInum\fP
278 lines·(default·-1,·meaning·no·limit).274 lines·(default·-1,·meaning·no·limit).
279 .Pp 
280 .It·Fl·c 
 275 .TP
 276 \fB\-c\fP
281 Causes·Ruby·to·check·the·syntax·of·the·script·and·exit·without277 Causes·Ruby·to·check·the·syntax·of·the·script·and·exit·without
282 executing.·If·there·are·no·syntax·errors,·Ruby·will·print278 executing.·If·there·are·no·syntax·errors,·Ruby·will·print
283 .Dq·Syntax·OK279 ``Syntax·OK''
284 to·the·standard·output.280 to·the·standard·output.
285 .Pp 
286 .It·Fl·d 
287 .It·Fl·-debug 
 281 .TP
 282 \fB\-d\fP
 283 .TP
 284 \fB\--debug\fP
288 Turns·on·debug·mode.285 Turns·on·debug·mode.
289 .Li·"$DEBUG"286 "$DEBUG"
290 will·be·set·to·true.287 will·be·set·to·true.
291 .Pp 
292 .It·Fl·e·Ar·command 
 288 .TP
 289 \fB\-e\fP·\fIcommand\fP
293 Specifies·script·from·command-line·while·telling·Ruby·not·to·search290 Specifies·script·from·command-line·while·telling·Ruby·not·to·search
294 the·rest·of·the·arguments·for·a·script·file·name.291 the·rest·of·the·arguments·for·a·script·file·name.
295 .Pp 
296 .It·Fl·h 
297 .It·Fl·-help 
 292 .TP
 293 \fB\-h\fP
 294 .TP
 295 \fB\--help\fP
298 Prints·a·summary·of·the·options.296 Prints·a·summary·of·the·options.
299 .Pp 
300 .It·Fl·i·Ar·extension 
 297 .TP
 298 \fB\-i\fP·\fIextension\fP
301 Specifies·in-place-edit·mode.··The·extension,·if·specified,·is·added299 Specifies·in-place-edit·mode.··The·extension,·if·specified,·is·added
302 to·old·file·name·to·make·a·backup·copy.··For·example:300 to·old·file·name·to·make·a·backup·copy.··For·example:
303 .Bd·-literal·-offset·indent 
304 %·echo·matz·>·/tmp/junk301 %·echo·matz·>·/tmp/junk
 302 .br
305 %·cat·/tmp/junk303 %·cat·/tmp/junk
 304 .br
306 matz305 matz
 306 .br
307 %·ruby·-p·-i.bak·-e·'$_.upcase!'·/tmp/junk307 %·ruby·-p·-i.bak·-e·'$_.upcase!'·/tmp/junk
 308 .br
308 %·cat·/tmp/junk309 %·cat·/tmp/junk
 310 .br
309 MATZ311 MATZ
 312 .br
310 %·cat·/tmp/junk.bak313 %·cat·/tmp/junk.bak
 314 .br
311 matz315 matz
312 .Ed 
313 .Pp 
314 .It·Fl·l316 .br
  
 317 .TP
 318 \fB\-l\fP
315 (The·lowercase·letter319 (The·lowercase·letter
316 .Dq·ell·.·)320 ``ell''.)
317 Enables·automatic·line-ending·processing,·which·means·to·firstly·set321 Enables·automatic·line-ending·processing,·which·means·to·firstly·set
318 .Li·"$\e"322 "$\e"
319 to·the·value·of323 to·the·value·of
320 .Li·"$/"·,324 "$/",
321 and·secondly·chops·every·line·read·using325 and·secondly·chops·every·line·read·using
322 .Li·chomp!·. 
323 .Pp 
324 .It·Fl·n326 chomp!.
  
 327 .TP
 328 \fB\-n\fP
325 Causes·Ruby·to·assume·the·following·loop·around·your·script,·which329 Causes·Ruby·to·assume·the·following·loop·around·your·script,·which
326 makes·it·iterate·over·file·name·arguments·somewhat·like330 makes·it·iterate·over·file·name·arguments·somewhat·like
327 .Nm·sed 
328 .Fl·n331 \fBsed\fP
 332 \fB\-n\fP
329 or333 or
330 .Nm·awk·. 
331 .Bd·-literal·-offset·indent334 \fBawk\fP.
  
332 while·gets335 while·gets
 336 .br
333 ··...337 ··...
 338 .br
334 end339 end
335 .Ed 
336 .Pp 
337 .It·Fl·p340 .br
  
 341 .TP
 342 \fB\-p\fP
338 Acts·mostly·same·as·-n·switch,·but·print·the·value·of·variable343 Acts·mostly·same·as·-n·switch,·but·print·the·value·of·variable
339 .Li·"$_"344 "$_"
340 at·the·each·end·of·the·loop.··For·example:345 at·the·each·end·of·the·loop.··For·example:
341 .Bd·-literal·-offset·indent 
342 %·echo·matz·|·ruby·-p·-e·'$_.tr!·"a-z",·"A-Z"'346 %·echo·matz·|·ruby·-p·-e·'$_.tr!·"a-z",·"A-Z"'
 347 .br
343 MATZ348 MATZ
344 .Ed 
345 .Pp 
346 .It·Fl·r·Ar·library349 .br
  
 350 .TP
 351 \fB\-r\fP·\fIlibrary\fP
347 Causes·Ruby·to·load·the·library·using·require.··It·is·useful·when·using352 Causes·Ruby·to·load·the·library·using·require.··It·is·useful·when·using
348 .Fl·n353 \fB\-n\fP
349 or354 or
350 .Fl·p·. 
351 .Pp 
352 .It·Fl·s355 \fB\-p\fP.
  
 356 .TP
 357 \fB\-s\fP
353 Enables·some·switch·parsing·for·switches·after·script·name·but·before358 Enables·some·switch·parsing·for·switches·after·script·name·but·before
354 any·file·name·arguments·(or·before·a359 any·file·name·arguments·(or·before·a
355 .Fl·-·)·.360 \fB\--\fP).
356 Any·switches·found·there·are·removed·from361 Any·switches·found·there·are·removed·from
357 .Li·ARGV362 ARGV
358 and·set·the·corresponding·variable·in·the·script.··For·example:363 and·set·the·corresponding·variable·in·the·script.··For·example:
359 .Bd·-literal·-offset·indent 
360 #!·/usr/local/bin/ruby·-s364 #!·/usr/local/bin/ruby·-s
 365 .br
361 #·prints·"true"·if·invoked·with·`-xyz'·switch.366 #·prints·"true"·if·invoked·with·`-xyz'·switch.
 367 .br
362 print·"true\en"·if·$xyz368 print·"true\en"·if·$xyz
363 .Ed 
364 .Pp 
365 .It·Fl·v369 .br
  
 370 .TP
 371 \fB\-v\fP
366 Enables·verbose·mode.··Ruby·will·print·its·version·at·the·beginning372 Enables·verbose·mode.··Ruby·will·print·its·version·at·the·beginning
367 and·set·the·variable373 and·set·the·variable
368 .Li·"$VERBOSE"374 "$VERBOSE"
369 to·true.··Some·methods·print·extra·messages·if·this·variable·is·true.375 to·true.··Some·methods·print·extra·messages·if·this·variable·is·true.
370 If·this·switch·is·given,·and·no·other·switches·are·present,·Ruby·quits376 If·this·switch·is·given,·and·no·other·switches·are·present,·Ruby·quits
371 after·printing·its·version.377 after·printing·its·version.
372 .Pp 
373 .It·Fl·w 
 378 .TP
 379 \fB\-w\fP
374 Enables·verbose·mode·without·printing·version·message·at·the380 Enables·verbose·mode·without·printing·version·message·at·the
375 beginning.··It·sets·the381 beginning.··It·sets·the
376 .Li·"$VERBOSE"382 "$VERBOSE"
377 variable·to·true.383 variable·to·true.
378 .Pp 
379 .It·Fl·x·Ns·Op·Ar·directory 
 384 .TP
 385 \fB\-x\fP[\fIdirectory\fP]
380 Tells·Ruby·that·the·script·is·embedded·in·a·message.··Leading·garbage386 Tells·Ruby·that·the·script·is·embedded·in·a·message.··Leading·garbage
381 will·be·discarded·until·the·first·line·that·starts·with387 will·be·discarded·until·the·first·line·that·starts·with
382 .Dq·#!388 ``#!''
383 and·contains·the·string,389 and·contains·the·string,
384 .Dq·ruby·.390 ``ruby''.
385 Any·meaningful·switches·on·that·line·will·be·applied.··The·end·of·the·script391 Any·meaningful·switches·on·that·line·will·be·applied.··The·end·of·the·script
386 must·be·specified·with·either392 must·be·specified·with·either
387 .Li·EOF·,393 EOF,
388 .Li·"^D"·(·Li·"control-D"·)·,394 "^D"·("control-D"),
389 .Li·"^Z"·(·Li·"control-Z"·)·,395 "^Z"·("control-Z"),
390 or·the·reserved·word396 or·the·reserved·word
391 .Li·__END__·.397 __END__.
392 If·the·directory·name·is·specified,·Ruby·will·switch·to·that·directory398 If·the·directory·name·is·specified,·Ruby·will·switch·to·that·directory
393 before·executing·script.399 before·executing·script.
394 .Pp 
395 .It·Fl·y 
396 .It·Fl·-yydebug 
 400 .TP
 401 \fB\-y\fP
 402 .TP
 403 \fB\--yydebug\fP
397 This·option·is·not·guaranteed·to·be·compatible.404 This·option·is·not·guaranteed·to·be·compatible.
398 .Pp 
399 Turns·on·compiler·debug·mode.··Ruby·will·print·a·bunch·of·internal405 Turns·on·compiler·debug·mode.··Ruby·will·print·a·bunch·of·internal
400 state·messages·during·compilation.··Only·specify·this·switch·you·are·going·to406 state·messages·during·compilation.··Only·specify·this·switch·you·are·going·to
401 debug·the·Ruby·interpreter.407 debug·the·Ruby·interpreter.
402 .Pp 
403 .It·Fl·-disable-·Ns·Ar·FEATURE 
404 .It·Fl·-enable-·Ns·Ar·FEATURE 
 408 .TP
 409 \fB\--disable-\fP\fIFEATURE\fP
 410 .TP
 411 \fB\--enable-\fP\fIFEATURE\fP
405 Disables·(or·enables)·the·specified412 Disables·(or·enables)·the·specified
406 .Ar·FEATURE·. 
407 .Bl·-tag·-width·"--disable-rubyopt"·-compact 
408 .It·Fl·-disable-gems 
409 .It·Fl·-enable-gems413 \fIFEATURE\fP.
 414 .TP
 415 \fB\--disable-gems\fP
 416 .TP
 417 \fB\--enable-gems\fP
410 Disables·(or·enables)·RubyGems·libraries.··By·default,·Ruby·will·load·the·latest418 Disables·(or·enables)·RubyGems·libraries.··By·default,·Ruby·will·load·the·latest
411 version·of·each·installed·gem.·The419 version·of·each·installed·gem.·The
412 .Li·Gem420 Gem
413 constant·is·true·if·RubyGems·is·enabled,·false·if·otherwise.421 constant·is·true·if·RubyGems·is·enabled,·false·if·otherwise.
414 .Pp 
415 .It·Fl·-disable-rubyopt 
416 .It·Fl·-enable-rubyopt 
 422 .TP
 423 \fB\--disable-rubyopt\fP
 424 .TP
 425 \fB\--enable-rubyopt\fP
417 Ignores·(or·considers)·the426 Ignores·(or·considers)·the
418 .Ev·RUBYOPT427 .IR·RUBYOPT
419 environment·variable.·By·default,·Ruby·considers·the·variable.428 environment·variable.·By·default,·Ruby·considers·the·variable.
420 .Pp 
421 .It·Fl·-disable-all 
422 .It·Fl·-enable-all 
 429 .TP
 430 \fB\--disable-all\fP
 431 .TP
 432 \fB\--enable-all\fP
423 Disables·(or·enables)·all·features.433 Disables·(or·enables)·all·features.
424 .Pp 
425 .El 
426 .Pp 
427 .It·Fl·-dump·Ns·=·Ns·Ar·target 
  
 434 .TP
 435 \fB\--dump\fP=\fItarget\fP
428 Dump·some·information.436 Dump·some·information.
429 .Pp 
430 Prints·the·specified·target.437 Prints·the·specified·target.
431 .Ar·target438 \fItarget\fP
432 can·be·one·of:439 can·be·one·of:
433 .Bl·-hang·-offset·indent440 .TP
434 .It·Sy·version441 .B·version
435 Print·version·description·(same·as442 Print·version·description·(same·as
436 .Fl·-version). 
437 .It·Sy·usage443 \fB\--version).\fP
 444 .TP
 445 .B·usage
438 Print·a·brief·usage·message·(same·as446 Print·a·brief·usage·message·(same·as
439 .Fl·h). 
440 .It·Sy·help447 \fB\-h).\fP
 448 .TP
 449 .B·help
441 Show·long·help·message·(same·as450 Show·long·help·message·(same·as
442 .Fl·-help). 
443 .It·Sy·syntax451 \fB\--help).\fP
 452 .TP
 453 .B·syntax
444 Check·syntax·(same·as454 Check·syntax·(same·as
 455 \fB\-c\fP
 456 \fB\--yydebug).\fP
  
  
445 .Fl·c 
446 .Fl·-yydebug). 
447 .Pp 
448 .El 
449 .Pp 
450 Or·one·of·the·following,·which·are·intended·for·debugging·the·interpreter:457 Or·one·of·the·following,·which·are·intended·for·debugging·the·interpreter:
451 .Bl·-hang·-offset·indent·-tag·-width·"parsetree_with_comment"458 .TP
452 .It·Sy·yydebug459 .B·yydebug
453 Enable·compiler·debug·mode·(same·as460 Enable·compiler·debug·mode·(same·as
454 .Fl·-yydebug).461 \fB\--yydebug).\fP
 462 .TP
455 .It·Sy·parsetree463 .B·parsetree
456 Print·a·textual·representation·of·the·Ruby·AST·for·the·program.464 Print·a·textual·representation·of·the·Ruby·AST·for·the·program.
 465 .TP
457 .It·Sy·parsetree_with_comment466 .B·parsetree_with_comment
458 Print·a·textual·representation·of·the·Ruby·AST·for·the·program,·but·with·each·node·annoted·with·the·associated·Ruby·source·code.467 Print·a·textual·representation·of·the·Ruby·AST·for·the·program,·but·with·each·node·annoted·with·the·associated·Ruby·source·code.
459 .It·Sy·insns468 .TP
 469 .B·insns
460 Print·a·list·of·disassembled·bytecode·instructions.470 Print·a·list·of·disassembled·bytecode·instructions.
 471 .TP
461 .It·Sy·insns_without_opt472 .B·insns_without_opt
462 Print·the·list·of·disassembled·bytecode·instructions·before·various·optimizations·have·been·applied.473 Print·the·list·of·disassembled·bytecode·instructions·before·various·optimizations·have·been·applied.
463 .El 
464 .Pp 
465 .It·Fl·-verbose 
 474 .TP
 475 \fB\--verbose\fP
466 Enables·verbose·mode·without·printing·version·message·at·the476 Enables·verbose·mode·without·printing·version·message·at·the
467 beginning.··It·sets·the477 beginning.··It·sets·the
468 .Li·"$VERBOSE"478 "$VERBOSE"
469 variable·to·true.479 variable·to·true.
470 If·this·switch·is·given,·and·no·script·arguments·(script·file·or480 If·this·switch·is·given,·and·no·script·arguments·(script·file·or
471 .Fl·e481 \fB\-e\fP
472 options)·are·present,·Ruby·quits·immediately.482 options)·are·present,·Ruby·quits·immediately.
473 .Pp 
474 .It·Fl·-crash-report·Ns·=·Ns·Ar·template 
 483 .TP
 484 \fB\--crash-report\fP=\fItemplate\fP
475 Sets·the·template·of·path·name·to·save·crash·report.485 Sets·the·template·of·path·name·to·save·crash·report.
476 See486 See
477 .Ev·RUBY_CRASH_REPORT487 .IR·RUBY_CRASH_REPORT
478 environment·variable·for·details.488 environment·variable·for·details.
  
479 .El 
480 .Pp 
481 .Sh·ENVIRONMENT489 .SH·ENVIRONMENT
482 .Bl·-tag·-width·"RUBYSHELL"·-compact490 .TP
483 .It·Ev·RUBYLIB491 .B·RUBYLIB
484 A·colon-separated·list·of·directories·that·are·added·to·Ruby's492 A·colon-separated·list·of·directories·that·are·added·to·Ruby's
485 library·load·path493 library·load·path
486 .Pf·(·Li·"$:"·)·.·Directories·from·this·environment·variable·are·searched494 ("$:").·Directories·from·this·environment·variable·are·searched
487 before·the·standard·load·path·is·searched.495 before·the·standard·load·path·is·searched.
488 .Pp 
489 e.g.:496 e.g.:
 497 .nf
490 .Dl·RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"498 \&··RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"
491 .Pp499 .fi
  
 500 .TP
492 .It·Ev·RUBYOPT501 .B·RUBYOPT
493 Additional·Ruby·options.502 Additional·Ruby·options.
494 .Pp 
495 e.g.503 e.g.
 504 .nf
496 .Dl·RUBYOPT="-w·-Ke"505 \&··RUBYOPT="-w·-Ke"
497 .Pp506 .fi
  
498 Note·that·RUBYOPT·can·contain·only507 Note·that·RUBYOPT·can·contain·only
499 .Fl·d·,·Fl·E·,·Fl·I·,·Fl·K·,·Fl·r·,·Fl·T·,·Fl·U·,·Fl·v·,·Fl·w·,·Fl·W,·Fl·-debug·, 
500 .Fl·-disable-·Ns·Ar·FEATURE508 \fB\-d\fP,\fB\-E\fP,\fB\-I\fP,\fB\-K\fP,\fB\-r\fP,\fB\-T\fP,\fB\-U\fP,\fB\-v\fP,\fB\-w\fP,\fB\-W,\fP·\fB\--debug\fP,
 509 \fB\--disable-\fP\fIFEATURE\fP
501 and510 and
502 .Fl·-enable-·Ns·Ar·FEATURE·. 
503 .Pp511 \fB\--enable-\fP\fIFEATURE\fP.
  
 512 .TP
504 .It·Ev·RUBYPATH513 .B·RUBYPATH
505 A·colon-separated·list·of·directories·that·Ruby·searches·for514 A·colon-separated·list·of·directories·that·Ruby·searches·for
506 Ruby·programs·when·the515 Ruby·programs·when·the
507 .Fl·S516 \fB\-S\fP
508 flag·is·specified.··This·variable·precedes·the517 flag·is·specified.··This·variable·precedes·the
509 .Ev·PATH518 .IR·PATH
510 environment·variable.519 environment·variable.
511 .Pp 
 520 .TP
512 .It·Ev·RUBYSHELL521 .B·RUBYSHELL
513 The·path·to·the·system·shell·command.··This·environment·variable·is522 The·path·to·the·system·shell·command.··This·environment·variable·is
514 enabled·for·only·mswin32,·mingw32,·and·OS/2·platforms.··If·this523 enabled·for·only·mswin32,·mingw32,·and·OS/2·platforms.··If·this
515 variable·is·not·defined,·Ruby·refers·to524 variable·is·not·defined,·Ruby·refers·to
516 .Ev·COMSPEC·.525 .IR·COMSPEC.
517 .Pp 
518 .It·Ev·PATH 
 526 .TP
 527 .B·PATH
519 Ruby·refers·to·the528 Ruby·refers·to·the
520 .Ev·PATH529 .IR·PATH
521 environment·variable·on·calling·Kernel#system.530 environment·variable·on·calling·Kernel#system.
  
522 .El 
523 .Pp 
524 And·Ruby·depends·on·some·RubyGems·related·environment·variables·unless·RubyGems·is·disabled.531 And·Ruby·depends·on·some·RubyGems·related·environment·variables·unless·RubyGems·is·disabled.
525 See·the·help·of532 See·the·help·of
526 .Xr·gem·1533 \fBgem\fP(1)
527 as·below.534 as·below.
528 .Bd·-literal·-offset·indent 
529 %·gem·help535 %·gem·help
530 .Ed 
531 .Pp536 .br
  
532 .Sh·GC·ENVIRONMENT537 .SH·GC·ENVIRONMENT
533 The·Ruby·garbage·collector·(GC)·tracks·objects·in·fixed-sized·slots,538 The·Ruby·garbage·collector·(GC)·tracks·objects·in·fixed-sized·slots,
534 but·each·object·may·have·auxiliary·memory·allocations·handled·by·the539 but·each·object·may·have·auxiliary·memory·allocations·handled·by·the
535 malloc·family·of·C·standard·library·calls·(540 malloc·family·of·C·standard·library·calls·(
536 .Xr·malloc·3·, 
537 .Xr·calloc·3·,541 \fBmalloc\fP(3),
 542 \fBcalloc\fP(3),
538 and543 and
539 .Xr·realloc·3·)·.544 \fBrealloc\fP(3))
540 In·this·documentatation,·the·"heap"·refers·to·the·Ruby·object·heap545 In·this·documentatation,·the·"heap"·refers·to·the·Ruby·object·heap
541 of·fixed-sized·slots,·while·"malloc"·refers·to·auxiliary546 of·fixed-sized·slots,·while·"malloc"·refers·to·auxiliary
542 allocations·commonly·referred·to·as·the·"process·heap".547 allocations·commonly·referred·to·as·the·"process·heap".
543 Thus·there·are·at·least·two·possible·ways·to·trigger·GC:548 Thus·there·are·at·least·two·possible·ways·to·trigger·GC:
544 .Bl·-hang·-offset·indent 
545 .It·Sy·1549 .TP
 550 .B·1
546 Reaching·the·object·limit.551 Reaching·the·object·limit.
547 .It·Sy·2552 .TP
 553 .B·2
548 Reaching·the·malloc·limit.554 Reaching·the·malloc·limit.
  
549 .Pp 
550 .El 
551 In·Ruby·2.1,·the·generational·GC·was·introduced·and·the·limits·are·divided555 In·Ruby·2.1,·the·generational·GC·was·introduced·and·the·limits·are·divided
552 into·young·and·old·generations,·providing·two·additional·ways·to·trigger556 into·young·and·old·generations,·providing·two·additional·ways·to·trigger
553 a·GC:557 a·GC:
554 .Bl·-hang·-offset·indent 
555 .It·Sy·3558 .TP
 559 .B·3
556 Reaching·the·old·object·limit.560 Reaching·the·old·object·limit.
557 .It·Sy·4561 .TP
 562 .B·4
558 Reaching·the·old·malloc·limit.563 Reaching·the·old·malloc·limit.
  
559 .El 
560 .Pp 
561 There·are·currently·4·possible·areas·where·the·GC·may·be·tuned·by564 There·are·currently·4·possible·areas·where·the·GC·may·be·tuned·by
562 the·following·11·environment·variables:565 the·following·11·environment·variables:
563 .Bl·-hang·-compact·-width·"RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR"566 .TP
564 .It·Ev·RUBY_GC_HEAP_INIT_SLOTS567 .B·RUBY_GC_HEAP_INIT_SLOTS
565 Initial·allocation·slots.·Applies·to·all·slot·sizes.··Introduced·in·Ruby·2.1,·default:·10000.568 Initial·allocation·slots.·Applies·to·all·slot·sizes.··Introduced·in·Ruby·2.1,·default:·10000.
566 .Pp 
 569 .TP
567 .It·Ev·RUBY_GC_HEAP_%d_INIT_SLOTS570 .B·RUBY_GC_HEAP_%d_INIT_SLOTS
568 Initial·allocation·of·slots·in·a·specific·heap.571 Initial·allocation·of·slots·in·a·specific·heap.
569 The·available·heaps·can·be·found·in·the·keys·of·`GC.stat_heap`.572 The·available·heaps·can·be·found·in·the·keys·of·`GC.stat_heap`.
570 Introduced·in·Ruby·3.3.573 Introduced·in·Ruby·3.3.
571 .Pp 
 574 .TP
572 .It·Ev·RUBY_GC_HEAP_FREE_SLOTS575 .B·RUBY_GC_HEAP_FREE_SLOTS
573 Prepare·at·least·this·amount·of·slots·after·GC.576 Prepare·at·least·this·amount·of·slots·after·GC.
574 Allocate·this·number·slots·if·there·are·not·enough·slots.577 Allocate·this·number·slots·if·there·are·not·enough·slots.
575 Introduced·in·Ruby·2.1,·default:·4096578 Introduced·in·Ruby·2.1,·default:·4096
576 .Pp 
 579 .TP
577 .It·Ev·RUBY_GC_HEAP_GROWTH_FACTOR580 .B·RUBY_GC_HEAP_GROWTH_FACTOR
578 Increase·allocation·rate·of·heap·slots·by·this·factor.581 Increase·allocation·rate·of·heap·slots·by·this·factor.
579 Introduced·in·Ruby·2.1,·default:·1.8,·minimum:·1.0·(no·growth)582 Introduced·in·Ruby·2.1,·default:·1.8,·minimum:·1.0·(no·growth)
580 .Pp 
 583 .TP
581 .It·Ev·RUBY_GC_HEAP_GROWTH_MAX_SLOTS584 .B·RUBY_GC_HEAP_GROWTH_MAX_SLOTS
582 Allocation·rate·is·limited·to·this·number·of·slots,585 Allocation·rate·is·limited·to·this·number·of·slots,
583 preventing·excessive·allocation·due·to·RUBY_GC_HEAP_GROWTH_FACTOR.586 preventing·excessive·allocation·due·to·RUBY_GC_HEAP_GROWTH_FACTOR.
584 Introduced·in·Ruby·2.1,·default:·0·(no·limit)587 Introduced·in·Ruby·2.1,·default:·0·(no·limit)
585 .Pp 
 588 .TP
586 .It·Ev·RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR589 .B·RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR
587 Perform·a·full·GC·when·the·number·of·old·objects·is·more·than·R·*·N,590 Perform·a·full·GC·when·the·number·of·old·objects·is·more·than·R·*·N,
588 where·R·is·this·factor·and·N·is·the·number·of·old·objects·after·the591 where·R·is·this·factor·and·N·is·the·number·of·old·objects·after·the
589 last·full·GC.592 last·full·GC.
590 Introduced·in·Ruby·2.1.1,·default:·2.0593 Introduced·in·Ruby·2.1.1,·default:·2.0
591 .Pp 
 594 .TP
592 .It·Ev·RUBY_GC_MALLOC_LIMIT595 .B·RUBY_GC_MALLOC_LIMIT
593 The·initial·limit·of·young·generation·allocation·from·the·malloc-family.596 The·initial·limit·of·young·generation·allocation·from·the·malloc-family.
594 GC·will·start·when·this·limit·is·reached.597 GC·will·start·when·this·limit·is·reached.
595 Default:·16MB598 Default:·16MB
596 .Pp 
 599 .TP
597 .It·Ev·RUBY_GC_MALLOC_LIMIT_MAX600 .B·RUBY_GC_MALLOC_LIMIT_MAX
598 The·maximum·limit·of·young·generation·allocation·from·malloc·before·GC·starts.601 The·maximum·limit·of·young·generation·allocation·from·malloc·before·GC·starts.
599 Prevents·excessive·malloc·growth·due·to·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.602 Prevents·excessive·malloc·growth·due·to·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.
600 Introduced·in·Ruby·2.1,·default:·32MB.603 Introduced·in·Ruby·2.1,·default:·32MB.
601 .Pp 
 604 .TP
602 .It·Ev·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR605 .B·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
603 Increases·the·limit·of·young·generation·malloc·calls,·reducing606 Increases·the·limit·of·young·generation·malloc·calls,·reducing
604 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_MALLOC_LIMIT_MAX607 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_MALLOC_LIMIT_MAX
605 is·reached.608 is·reached.
606 Introduced·in·Ruby·2.1,·default:·1.4,·minimum:·1.0·(no·growth)609 Introduced·in·Ruby·2.1,·default:·1.4,·minimum:·1.0·(no·growth)
607 .Pp 
 610 .TP
608 .It·Ev·RUBY_GC_OLDMALLOC_LIMIT611 .B·RUBY_GC_OLDMALLOC_LIMIT
609 The·initial·limit·of·old·generation·allocation·from·malloc,612 The·initial·limit·of·old·generation·allocation·from·malloc,
610 a·full·GC·will·start·when·this·limit·is·reached.613 a·full·GC·will·start·when·this·limit·is·reached.
611 Introduced·in·Ruby·2.1,·default:·16MB614 Introduced·in·Ruby·2.1,·default:·16MB
612 .Pp 
 615 .TP
613 .It·Ev·RUBY_GC_OLDMALLOC_LIMIT_MAX616 .B·RUBY_GC_OLDMALLOC_LIMIT_MAX
614 The·maximum·limit·of·old·generation·allocation·from·malloc·before·a617 The·maximum·limit·of·old·generation·allocation·from·malloc·before·a
615 full·GC·starts.618 full·GC·starts.
616 Prevents·excessive·malloc·growth·due·to·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR.619 Prevents·excessive·malloc·growth·due·to·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR.
617 Introduced·in·Ruby·2.1,·default:·128MB620 Introduced·in·Ruby·2.1,·default:·128MB
618 .Pp 
 621 .TP
619 .It·Ev·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR622 .B·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
620 Increases·the·limit·of·old·generation·malloc·allocation,·reducing·full623 Increases·the·limit·of·old·generation·malloc·allocation,·reducing·full
621 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_OLDMALLOC_LIMIT_MAX624 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_OLDMALLOC_LIMIT_MAX
622 is·reached.625 is·reached.
623 Introduced·in·Ruby·2.1,·default:·1.2,·minimum:·1.0·(no·growth)626 Introduced·in·Ruby·2.1,·default:·1.2,·minimum:·1.0·(no·growth)
  
624 .Pp 
625 .El 
626 .Sh·STACK·SIZE·ENVIRONMENT627 .SH·STACK·SIZE·ENVIRONMENT
627 Stack·size·environment·variables·are·implementation-dependent·and628 Stack·size·environment·variables·are·implementation-dependent·and
628 subject·to·change·with·different·versions·of·Ruby.··The·VM·stack·is·used629 subject·to·change·with·different·versions·of·Ruby.··The·VM·stack·is·used
629 for·pure-Ruby·code·and·managed·by·the·virtual·machine.··Machine·stack·is630 for·pure-Ruby·code·and·managed·by·the·virtual·machine.··Machine·stack·is
630 used·by·the·operating·system·and·its·usage·is·dependent·on·C·extensions631 used·by·the·operating·system·and·its·usage·is·dependent·on·C·extensions
631 as·well·as·C·compiler·options.··Using·lower·values·for·these·may·allow632 as·well·as·C·compiler·options.··Using·lower·values·for·these·may·allow
632 applications·to·keep·more·Fibers·or·Threads·running;·but·increases·the633 applications·to·keep·more·Fibers·or·Threads·running;·but·increases·the
633 chance·of·SystemStackError·exceptions·and·segmentation·faults·(SIGSEGV).634 chance·of·SystemStackError·exceptions·and·segmentation·faults·(SIGSEGV).
634 These·environment·variables·are·available·since·Ruby·2.0.0.635 These·environment·variables·are·available·since·Ruby·2.0.0.
635 All·values·are·specified·in·bytes.636 All·values·are·specified·in·bytes.
636 .Pp 
637 .Bl·-hang·-compact·-width·"RUBY_THREAD_MACHINE_STACK_SIZE" 
 637 .TP
638 .It·Ev·RUBY_THREAD_VM_STACK_SIZE638 .B·RUBY_THREAD_VM_STACK_SIZE
639 VM·stack·size·used·at·thread·creation.639 VM·stack·size·used·at·thread·creation.
640 default:·524288·(32-bit·CPU)·or·1048575·(64-bit)640 default:·524288·(32-bit·CPU)·or·1048575·(64-bit)
641 .Pp 
 641 .TP
642 .It·Ev·RUBY_THREAD_MACHINE_STACK_SIZE642 .B·RUBY_THREAD_MACHINE_STACK_SIZE
643 Machine·stack·size·used·at·thread·creation.643 Machine·stack·size·used·at·thread·creation.
644 default:·524288·or·1048575644 default:·524288·or·1048575
645 .Pp 
 645 .TP
646 .It·Ev·RUBY_FIBER_VM_STACK_SIZE646 .B·RUBY_FIBER_VM_STACK_SIZE
647 VM·stack·size·used·at·fiber·creation.647 VM·stack·size·used·at·fiber·creation.
648 default:·65536·or·131072648 default:·65536·or·131072
649 .Pp 
 649 .TP
650 .It·Ev·RUBY_FIBER_MACHINE_STACK_SIZE650 .B·RUBY_FIBER_MACHINE_STACK_SIZE
651 Machine·stack·size·used·at·fiber·creation.651 Machine·stack·size·used·at·fiber·creation.
652 default:·262144·or·524288652 default:·262144·or·524288
  
653 .Pp 
654 .El 
655 .Sh·CRASH·REPORT·ENVIRONMENT653 .SH·CRASH·REPORT·ENVIRONMENT
656 .Pp 
657 .Bl·-tag·-compact·-width·"RUBY_CRASH_REPORT" 
 654 .TP
658 .It·Ev·RUBY_CRASH_REPORT655 .B·RUBY_CRASH_REPORT
659 The·template·of·path·name·to·save·crash·report.656 The·template·of·path·name·to·save·crash·report.
660 default:·none657 default:·none
661 .El 
662 .Ss·Naming·crash·report·files658 .SS·Naming·crash·report·files
663 The·template·can·contain659 The·template·can·contain
664 .Li·\fB%\fP660 \fB%\fP
665 specifiers·which·are·substituted·by·the·following·values·when·a·crash661 specifiers·which·are·substituted·by·the·following·values·when·a·crash
666 report·file·is·created:662 report·file·is·created:
667 .Pp 
668 .Bl·-hang·-compact·-width·"%NNN" 
669 .It·Li·\fB%%\fP 
 663 .TP
 664 \fB%%\fP
670 A·single665 A·single
671 .Li·\fB%\fP666 \fB%\fP
672 character.667 character.
673 .It·Li·\fB%e\fP668 .TP
 669 \fB%e\fP
674 Basename·of·executable.670 Basename·of·executable.
675 .It·Li·\fB%E\fP671 .TP
 672 \fB%E\fP
676 Pathname·of·executable,673 Pathname·of·executable,
677 with·slashes·(\fB/\fP)·replaced·by·exclamation·marks·(\fB!\fP).674 with·slashes·(\fB/\fP)·replaced·by·exclamation·marks·(\fB!\fP).
678 .It·Li·\fB%f\fP675 .TP
 676 \fB%f\fP
679 Basename·of·the·program·name,677 Basename·of·the·program·name,
680 .Li·"$0"·. 
681 .It·Li·\fB%F\fP678 "$0".
 679 .TP
 680 \fB%F\fP
682 Pathname·of·the·program·name,681 Pathname·of·the·program·name,
683 .Li·"$0",682 "$0",
684 with·slashes·(\fB/\fP)·replaced·by·exclamation·marks·(\fB!\fP).683 with·slashes·(\fB/\fP)·replaced·by·exclamation·marks·(\fB!\fP).
685 .It·Li·\fB%p\fP684 .TP
 685 \fB%p\fP
686 PID·of·dumped·process.686 PID·of·dumped·process.
687 .It·Li·\fB%t\fP687 .TP
 688 \fB%t\fP
688 Time·of·dump,·expressed·as·seconds·since·the689 Time·of·dump,·expressed·as·seconds·since·the
689 Epoch,·1970-01-01·00:00:00·+0000·(UTC).690 Epoch,·1970-01-01·00:00:00·+0000·(UTC).
690 .It·Li·\fB%NNN\fP691 .TP
 692 \fB%NNN\fP
691 A·character·code·in·octal.693 A·character·code·in·octal.
  
692 .El 
693 .Pp 
694 A·single694 A·single
695 .Li·\fB%\fP695 \fB%\fP
696 at·the·end·of·the·template·is·dropped·from·the·core·filename,·as·is696 at·the·end·of·the·template·is·dropped·from·the·core·filename,·as·is
697 the·combination·of·a697 the·combination·of·a
698 .Li·\fB%\fP698 \fB%\fP
699 followed·by·any·character·other·than·those·listed·above.··All·other699 followed·by·any·character·other·than·those·listed·above.··All·other
700 characters·in·the·template·become·a·literal·part·of·the·core·filename.700 characters·in·the·template·become·a·literal·part·of·the·core·filename.
701 The·template·may·include·\(aq/\(aq·characters,·which·are·interpreted701 The·template·may·include·\(aq/\(aq·characters,·which·are·interpreted
702 as·delimiters·for·directory·names.702 as·delimiters·for·directory·names.
703 .Ss·Piping·crash·reports·to·a·program703 .SS·Piping·crash·reports·to·a·program
704 If·the·first·character·of·this·file·is·a·pipe·symbol·(\fB|\fP),704 If·the·first·character·of·this·file·is·a·pipe·symbol·(\fB|\fP),
705 then·the·remainder·of·the·line·is·interpreted·as·the·command-line·for705 then·the·remainder·of·the·line·is·interpreted·as·the·command-line·for
706 a·program·(or·script)·that·is·to·be·executed.706 a·program·(or·script)·that·is·to·be·executed.
707 .Pp 
708 The·pipe·template·is·split·on·spaces·into·an·argument·list·before·the707 The·pipe·template·is·split·on·spaces·into·an·argument·list·before·the
709 template·parameters·are·expanded.708 template·parameters·are·expanded.
710 .Sh·SEE·ALSO709 .SH·SEE·ALSO
711 .Bl·-hang·-compact·-width·"https://www.ruby-toolbox.com/"710 .TP
712 .It·Lk·https://www.ruby-lang.org/711 .B·https://www.ruby-lang.org/
713 The·official·web·site.712 The·official·web·site.
 713 .TP
714 .It·Lk·https://www.ruby-toolbox.com/714 .B·https://www.ruby-toolbox.com/
715 Comprehensive·catalog·of·Ruby·libraries.715 Comprehensive·catalog·of·Ruby·libraries.
  
716 .El 
717 .Pp 
718 .Sh·REPORTING·BUGS716 .SH·REPORTING·BUGS
 717 .IP·\(bu
719 .Bl·-bullet 
720 .It 
721 Security·vulnerabilities·should·be·reported·via·an·email·to718 Security·vulnerabilities·should·be·reported·via·an·email·to
722 .Mt·security@ruby-lang.org·.719 Mt·security@ruby-lang.org.
723 Reported·problems·will·be·published·after·being·fixed.720 Reported·problems·will·be·published·after·being·fixed.
724 .Pp 
725 .It 
 721 .IP·\(bu
726 Other·bugs·and·feature·requests·can·be·reported·via·the722 Other·bugs·and·feature·requests·can·be·reported·via·the
727 Ruby·Issue·Tracking·System723 Ruby·Issue·Tracking·System
728 .Pq·Lk·https://bugs.ruby-lang.org/·.724 (\fBhttps://bugs.ruby-lang.org/\fP).
729 Do·not·report·security·vulnerabilities725 Do·not·report·security·vulnerabilities
730 via·this·system·because·it·publishes·the·vulnerabilities·immediately.726 via·this·system·because·it·publishes·the·vulnerabilities·immediately.
731 .El 
732 .Sh·AUTHORS727 .SH·AUTHORS
733 Ruby·is·designed·and·implemented·by728 Ruby·is·designed·and·implemented·by
734 .An·Yukihiro·Matsumoto·Aq·matz@netlab.jp·.729 Yukihiro·Matsumoto·<matz@netlab.jp>.
735 .Pp 
736 See730 See
737 .Aq·Lk·https://github.com/ruby/ruby/graphs/contributors731 <\fBhttps://github.com/ruby/ruby/graphs/contributors\fP>
738 for·contributors·to·Ruby.732 for·contributors·to·Ruby.