Offset 1, 664 lines modifiedOffset 1, 759 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·- 
29 .Op·Ar·program_file 
30 .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\--\fP]
 27 [\fIprogram_file\fP]
 28 [\fIargument\fP·...]
31 .Sh·DESCRIPTION29 .SH·DESCRIPTION
32 Ruby·is·an·interpreted·scripting·language·for·quick·and·easy30 Ruby·is·an·interpreted·scripting·language·for·quick·and·easy
33 object-oriented·programming.··It·has·many·features·to·process·text31 object-oriented·programming.··It·has·many·features·to·process·text
34 files·and·to·do·system·management·tasks·(like·in·Perl).··It·is·simple,32 files·and·to·do·system·management·tasks·(like·in·Perl).··It·is·simple,
35 straight-forward,·and·extensible.33 straight-forward,·and·extensible.
36 .Pp 
37 If·you·want·a·language·for·easy·object-oriented·programming,·or·you34 If·you·want·a·language·for·easy·object-oriented·programming,·or·you
38 don't·like·the·Perl·ugliness,·or·you·do·like·the·concept·of·LISP,·but35 don't·like·the·Perl·ugliness,·or·you·do·like·the·concept·of·LISP,·but
39 don't·like·too·many·parentheses,·Ruby·might·be·your·language·of36 don't·like·too·many·parentheses,·Ruby·might·be·your·language·of
40 choice.37 choice.
41 .Sh·FEATURES38 .SH·FEATURES
42 Ruby's·features·are·as·follows:39 Ruby's·features·are·as·follows:
43 .Bl·-tag·-width·6n40 .TP
44 .It·Sy·"Interpretive"41 .B·"Interpretive"
45 Ruby·is·an·interpreted·language,·so·you·don't·have·to·recompile42 Ruby·is·an·interpreted·language,·so·you·don't·have·to·recompile
46 programs·written·in·Ruby·to·execute·them.43 programs·written·in·Ruby·to·execute·them.
47 .Pp 
 44 .TP
48 .It·Sy·"Variables·have·no·type·(dynamic·typing)"45 .B·"Variables·have·no·type·(dynamic·typing)"
49 Variables·in·Ruby·can·contain·data·of·any·type.··You·don't·have·to46 Variables·in·Ruby·can·contain·data·of·any·type.··You·don't·have·to
50 worry·about·variable·typing.··Consequently,·it·has·a·weaker·compile47 worry·about·variable·typing.··Consequently,·it·has·a·weaker·compile
51 time·check.48 time·check.
52 .Pp 
 49 .TP
53 .It·Sy·"No·declaration·needed"50 .B·"No·declaration·needed"
54 You·can·use·variables·in·your·Ruby·programs·without·any·declarations.51 You·can·use·variables·in·your·Ruby·programs·without·any·declarations.
55 Variable·names·denote·their·scope·-·global,·class,·instance,·or·local.52 Variable·names·denote·their·scope·-·global,·class,·instance,·or·local.
56 .Pp 
 53 .TP
57 .It·Sy·"Simple·syntax"54 .B·"Simple·syntax"
58 Ruby·has·a·simple·syntax·influenced·slightly·from·Eiffel.55 Ruby·has·a·simple·syntax·influenced·slightly·from·Eiffel.
59 .Pp 
 56 .TP
60 .It·Sy·"No·user-level·memory·management"57 .B·"No·user-level·memory·management"
61 Ruby·has·automatic·memory·management.··Objects·no·longer·referenced58 Ruby·has·automatic·memory·management.··Objects·no·longer·referenced
62 from·anywhere·are·automatically·collected·by·the·garbage·collector59 from·anywhere·are·automatically·collected·by·the·garbage·collector
63 built·into·the·interpreter.60 built·into·the·interpreter.
64 .Pp 
 61 .TP
65 .It·Sy·"Everything·is·an·object"62 .B·"Everything·is·an·object"
66 Ruby·is·a·purely·object-oriented·language,·and·was·so·since·its63 Ruby·is·a·purely·object-oriented·language,·and·was·so·since·its
67 creation.··Even·such·basic·data·as·integers·are·seen·as·objects.64 creation.··Even·such·basic·data·as·integers·are·seen·as·objects.
68 .Pp 
 65 .TP
69 .It·Sy·"Class,·inheritance,·and·methods"66 .B·"Class,·inheritance,·and·methods"
70 Being·an·object-oriented·language,·Ruby·naturally·has·basic67 Being·an·object-oriented·language,·Ruby·naturally·has·basic
71 features·like·classes,·inheritance,·and·methods.68 features·like·classes,·inheritance,·and·methods.
72 .Pp 
 69 .TP
73 .It·Sy·"Singleton·methods"70 .B·"Singleton·methods"
74 Ruby·has·the·ability·to·define·methods·for·certain·objects.··For71 Ruby·has·the·ability·to·define·methods·for·certain·objects.··For
75 example,·you·can·define·a·press-button·action·for·certain·widget·by72 example,·you·can·define·a·press-button·action·for·certain·widget·by
76 defining·a·singleton·method·for·the·button.··Or,·you·can·make·up·your73 defining·a·singleton·method·for·the·button.··Or,·you·can·make·up·your
77 own·prototype·based·object·system·using·singleton·methods,·if·you·want74 own·prototype·based·object·system·using·singleton·methods,·if·you·want
78 to.75 to.
79 .Pp 
 76 .TP
80 .It·Sy·"Mix-in·by·modules"77 .B·"Mix-in·by·modules"
81 Ruby·intentionally·does·not·have·the·multiple·inheritance·as·it·is·a78 Ruby·intentionally·does·not·have·the·multiple·inheritance·as·it·is·a
82 source·of·confusion.··Instead,·Ruby·has·the·ability·to·share79 source·of·confusion.··Instead,·Ruby·has·the·ability·to·share
83 implementations·across·the·inheritance·tree.··This·is·often·called·a80 implementations·across·the·inheritance·tree.··This·is·often·called·a
84 .Sq·Mix-in·. 
85 .Pp81 `Mix-in'.
  
 82 .TP
86 .It·Sy·"Iterators"83 .B·"Iterators"
87 Ruby·has·iterators·for·loop·abstraction.84 Ruby·has·iterators·for·loop·abstraction.
88 .Pp 
 85 .TP
89 .It·Sy·"Closures"86 .B·"Closures"
90 In·Ruby,·you·can·objectify·the·procedure.87 In·Ruby,·you·can·objectify·the·procedure.
91 .Pp 
 88 .TP
92 .It·Sy·"Text·processing·and·regular·expressions"89 .B·"Text·processing·and·regular·expressions"
93 Ruby·has·a·bunch·of·text·processing·features·like·in·Perl.90 Ruby·has·a·bunch·of·text·processing·features·like·in·Perl.
94 .Pp 
 91 .TP
95 .It·Sy·"M17N,·character·set·independent"92 .B·"M17N,·character·set·independent"
96 Ruby·supports·multilingualized·programming.·Easy·to·process·texts93 Ruby·supports·multilingualized·programming.·Easy·to·process·texts
97 written·in·many·different·natural·languages·and·encoded·in·many94 written·in·many·different·natural·languages·and·encoded·in·many
98 different·character·encodings,·without·dependence·on·Unicode.95 different·character·encodings,·without·dependence·on·Unicode.
99 .Pp 
 96 .TP
100 .It·Sy·"Bignums"97 .B·"Bignums"
101 With·built-in·bignums,·you·can·for·example·calculate·factorial(400).98 With·built-in·bignums,·you·can·for·example·calculate·factorial(400).
102 .Pp 
 99 .TP
103 .It·Sy·"Reflection·and·domain·specific·languages"100 .B·"Reflection·and·domain·specific·languages"
104 Class·is·also·an·instance·of·the·Class·class.·Definition·of·classes·and·methods101 Class·is·also·an·instance·of·the·Class·class.·Definition·of·classes·and·methods
105 is·an·expression·just·as·1+1·is.·So·your·programs·can·even·write·and·modify·programs.102 is·an·expression·just·as·1+1·is.·So·your·programs·can·even·write·and·modify·programs.
106 Thus·you·can·write·your·application·in·your·own·programming·language·on·top·of·Ruby.103 Thus·you·can·write·your·application·in·your·own·programming·language·on·top·of·Ruby.
107 .Pp 
 104 .TP
108 .It·Sy·"Exception·handling"105 .B·"Exception·handling"
109 As·in·Java(tm).106 As·in·Java(tm).
110 .Pp 
 107 .TP
111 .It·Sy·"Direct·access·to·the·OS"108 .B·"Direct·access·to·the·OS"
112 Ruby·can·use·most109 Ruby·can·use·most
113 .Ux110 UNIX
114 system·calls,·often·used·in·system·programming.111 system·calls,·often·used·in·system·programming.
115 .Pp 
 112 .TP
116 .It·Sy·"Dynamic·loading"113 .B·"Dynamic·loading"
117 On·most114 On·most
118 .Ux115 UNIX
119 systems,·you·can·load·object·files·into·the·Ruby·interpreter116 systems,·you·can·load·object·files·into·the·Ruby·interpreter
120 on-the-fly.117 on-the-fly.
 118 .TP
121 .It·Sy·"Rich·libraries"119 .B·"Rich·libraries"
122 In·addition·to·the120 In·addition·to·the
123 .Dq·builtin·libraries121 ``builtin·libraries''
124 and122 and
125 .Dq·standard·libraries123 ``standard·libraries''
126 that·are·bundled·with·Ruby,·a·vast·amount·of·third-party·libraries124 that·are·bundled·with·Ruby,·a·vast·amount·of·third-party·libraries
127 .Pq·Dq·gems125 (``gems'')
128 are·available·via·the·package·management·system·called126 are·available·via·the·package·management·system·called
129 .Sq·RubyGems·,127 `RubyGems',
130 namely·the128 namely·the
131 .Xr·gem·1129 \fBgem\fP(1)
132 command.··Visit·RubyGems.org130 command.··Visit·RubyGems.org
133 .Pq·Lk·https://rubygems.org/131 (\fBhttps://rubygems.org/\fP)
134 to·find·the·gems·you·need,·and·explore·GitHub132 to·find·the·gems·you·need,·and·explore·GitHub
135 .Pq·Lk·https://github.com/133 (\fBhttps://github.com/\fP)
136 to·see·how·they·are·being·developed·and·used.134 to·see·how·they·are·being·developed·and·used.
  
137 .El 
138 .Pp 
139 .Sh·OPTIONS135 .SH·OPTIONS
140 The·Ruby·interpreter·accepts·the·following·command-line·options·(switches).136 The·Ruby·interpreter·accepts·the·following·command-line·options·(switches).
141 They·are·quite·similar·to·those·of137 They·are·quite·similar·to·those·of
142 .Xr·perl·1·. 
143 .Bl·-tag·-width·"1234567890123"·-compact 
144 .Pp 
145 .It·Fl·-copyright138 \fBperl\fP(1).
  
 139 .TP
 140 \fB\--copyright\fP
146 Prints·the·copyright·notice,·and·quits·immediately·without·running·any141 Prints·the·copyright·notice,·and·quits·immediately·without·running·any
147 script.142 script.
148 .Pp 
149 .It·Fl·-version 
 143 .TP
 144 \fB\--version\fP
150 Prints·the·version·of·the·Ruby·interpreter,·and·quits·immediately·without145 Prints·the·version·of·the·Ruby·interpreter,·and·quits·immediately·without
151 running·any·script.146 running·any·script.
152 .Pp 
153 .It·Fl·0·Ns·Op·Ar·octal 
 147 .TP
 148 \fB\-0\fP[\fIoctal\fP]
154 (The·digit149 (The·digit
155 .Dq·zero·.·)150 ``zero''.)
156 Specifies·the·input·record·separator151 Specifies·the·input·record·separator
157 .Pf·(·Li·"$/"·)152 ("$/")
158 as·an·octal·number.·If·no·digit·is·given,·the·null·character·is·taken153 as·an·octal·number.·If·no·digit·is·given,·the·null·character·is·taken
159 as·the·separator.··Other·switches·may·follow·the·digits.154 as·the·separator.··Other·switches·may·follow·the·digits.
160 .Fl·00155 \fB\-00\fP
161 turns·Ruby·into·paragraph·mode.156 turns·Ruby·into·paragraph·mode.
162 .Fl·0777157 \fB\-0777\fP
163 makes·Ruby·read·whole·file·at·once·as·a·single·string·since·there·is158 makes·Ruby·read·whole·file·at·once·as·a·single·string·since·there·is
164 no·legal·character·with·that·value.159 no·legal·character·with·that·value.
165 .Pp 
166 .It·Fl·C·Ar·directory 
167 .It·Fl·X·Ar·directory 
 160 .TP
 161 \fB\-C\fP·\fIdirectory\fP
 162 .TP
 163 \fB\-X\fP·\fIdirectory\fP
168 Causes·Ruby·to·switch·to·the·directory.164 Causes·Ruby·to·switch·to·the·directory.
169 .Pp 
170 .It·Fl·E·Ar·external·Ns·Op·:·Ns·Ar·internal 
171 .It·Fl·-encoding·Ar·external·Ns·Op·:·Ns·Ar·internal 
 165 .TP
 166 \fB\-E\fP·\fIexternal\fP[:\fIinternal\fP]
 167 .TP
 168 \fB\--encoding\fP·\fIexternal\fP[:\fIinternal\fP]
172 Specifies·the·default·value(s)·for·external·encodings·and·internal·encoding.·Values·should·be·separated·with·colon·(:).169 Specifies·the·default·value(s)·for·external·encodings·and·internal·encoding.·Values·should·be·separated·with·colon·(:).
173 .Pp 
174 You·can·omit·the·one·for·internal·encodings,·then·the·value170 You·can·omit·the·one·for·internal·encodings,·then·the·value
175 .Pf·(·Li·"Encoding.default_internal"·)·will·be·nil.171 ("Encoding.default_internal")·will·be·nil.
176 .Pp 
177 .It·Fl·-external-encoding·Ns·=·Ns·Ar·encoding 
178 .It·Fl·-internal-encoding·Ns·=·Ns·Ar·encoding 
 172 .TP
 173 \fB\--external-encoding\fP=\fIencoding\fP
 174 .TP
 175 \fB\--internal-encoding\fP=\fIencoding\fP
179 Specify·the·default·external·or·internal·character·encoding176 Specify·the·default·external·or·internal·character·encoding
180 .Pp 
181 .It·Fl·F·Ar·pattern 
 177 .TP
 178 \fB\-F\fP·\fIpattern\fP
182 Specifies·input·field·separator179 Specifies·input·field·separator
183 .Pf·(·Li·"$;"·)·. 
184 .Pp 
185 .It·Fl·I·Ar·directory180 ("$;").
  
 181 .TP
 182 \fB\-I\fP·\fIdirectory\fP
186 Used·to·tell·Ruby·where·to·load·the·library·scripts.··Directory·path183 Used·to·tell·Ruby·where·to·load·the·library·scripts.··Directory·path
187 will·be·added·to·the·load-path·variable184 will·be·added·to·the·load-path·variable
188 .Pf·(·Li·"$:"·)·. 
189 .Pp 
190 .It·Fl·K·Ar·kcode185 ("$:").
  
 186 .TP
 187 \fB\-K\fP·\fIkcode\fP
191 Specifies·KANJI·(Japanese)·encoding.·The·default·value·for·script·encodings188 Specifies·KANJI·(Japanese)·encoding.·The·default·value·for·script·encodings
192 .Pf·(·Li·"__ENCODING__"·)·and·external·encodings·(·Li·"Encoding.default_external"·)·will·be·the·specified·one.189 ("__ENCODING__")·and·external·encodings·("Encoding.default_external")·will·be·the·specified·one.
193 .Ar·kcode190 \fIkcode\fP
194 can·be·one·of191 can·be·one·of
195 .Bl·-hang·-offset·indent 
196 .It·Sy·e192 .TP
 193 .B·e
197 EUC-JP194 EUC-JP
198 .Pp 
199 .It·Sy·s 
 195 .TP
 196 .B·s
200 Windows-31J·(CP932)197 Windows-31J·(CP932)
201 .Pp 
202 .It·Sy·u 
 198 .TP
 199 .B·u
203 UTF-8200 UTF-8
204 .Pp 
205 .It·Sy·n 
 201 .TP
 202 .B·n
206 ASCII-8BIT·(BINARY)203 ASCII-8BIT·(BINARY)
207 .El 
208 .Pp 
209 .It·Fl·S 
 204 .TP
 205 \fB\-S\fP
210 Makes·Ruby·use·the206 Makes·Ruby·use·the
211 .Ev·PATH207 .IR·PATH
212 environment·variable·to·search·for·script,·unless·its·name·begins208 environment·variable·to·search·for·script,·unless·its·name·begins
213 with·a·slash.··This·is·used·to·emulate209 with·a·slash.··This·is·used·to·emulate
214 .Li·#!210 #!
215 on·machines·that·don't·support·it,·in·the·following·manner:211 on·machines·that·don't·support·it,·in·the·following·manner:
216 .Bd·-literal·-offset·indent 
217 #!·/usr/local/bin/ruby212 #!·/usr/local/bin/ruby
 213 .br
218 #·This·line·makes·the·next·one·a·comment·in·Ruby·\e214 #·This·line·makes·the·next·one·a·comment·in·Ruby·\e
 215 .br
219 ··exec·/usr/local/bin/ruby·-S·$0·$*216 ··exec·/usr/local/bin/ruby·-S·$0·$*
220 .Ed 
221 .Pp217 .br
  
222 On·some·systems218 On·some·systems
223 .Li·"$0"219 "$0"
224 does·not·always·contain·the·full·pathname,·so·you·need·the220 does·not·always·contain·the·full·pathname,·so·you·need·the
225 .Fl·S221 \fB\-S\fP
226 switch·to·tell·Ruby·to·search·for·the·script·if·necessary·(to·handle·embedded222 switch·to·tell·Ruby·to·search·for·the·script·if·necessary·(to·handle·embedded
227 spaces·and·such).··A·better·construct·than223 spaces·and·such).··A·better·construct·than
228 .Li·"$*"224 "$*"
229 would·be225 would·be
230 .Li·${1+"$@"}·,226 ${1+"$@"},
231 but·it·does·not·work·if·the·script·is·being·interpreted·by227 but·it·does·not·work·if·the·script·is·being·interpreted·by
232 .Xr·csh·1·. 
233 .Pp 
234 .It·Fl·T·Ns·Op·Ar·level=1228 \fBcsh\fP(1).
  
 229 .TP
 230 \fB\-T\fP[\fIlevel=1\fP]
235 Turns·on·taint·checks·at·the·specified·level·(default·1).231 Turns·on·taint·checks·at·the·specified·level·(default·1).
236 .Pp 
237 .It·Fl·U 
 232 .TP
 233 \fB\-U\fP
238 Sets·the·default·value·for·internal·encodings234 Sets·the·default·value·for·internal·encodings
239 .Pf·(·Li·"Encoding.default_internal"·)·to·UTF-8.235 ("Encoding.default_internal")·to·UTF-8.
240 .Pp 
241 .It·Fl·W·Ns·Op·Ar·level=2 
 236 .TP
 237 \fB\-W\fP[\fIlevel=2\fP]
242 Turns·on·verbose·mode·at·the·specified·level·without·printing·the·version238 Turns·on·verbose·mode·at·the·specified·level·without·printing·the·version
243 message·at·the·beginning.·The·level·can·be;239 message·at·the·beginning.·The·level·can·be;
244 .Bl·-hang·-offset·indent 
245 .It·Sy·0240 .TP
 241 .B·0
246 Verbose·mode·is·"silence".·It·sets·the242 Verbose·mode·is·"silence".·It·sets·the
247 .Li·"$VERBOSE"243 "$VERBOSE"
248 to·nil.244 to·nil.
249 .Pp 
250 .It·Sy·1 
 245 .TP
 246 .B·1
251 Verbose·mode·is·"medium".·It·sets·the247 Verbose·mode·is·"medium".·It·sets·the
252 .Li·"$VERBOSE"248 "$VERBOSE"
253 to·false.249 to·false.
254 .Pp 
 250 .TP
255 .It·Sy·2·(default)251 .B·2·(default)
256 Verbose·mode·is·"verbose".·It·sets·the252 Verbose·mode·is·"verbose".·It·sets·the
257 .Li·"$VERBOSE"253 "$VERBOSE"
258 to·true.254 to·true.
259 .Fl·W·Ns255 \fB\-W\fP
260 2·is·the·same·as256 2·is·the·same·as
 257 \fB\-w\fP
  
 258 .TP
 259 \fB\-a\fP
261 .Fl·w 
262 . 
263 .El 
264 .Pp 
265 .It·Fl·a 
266 Turns·on·auto-split·mode·when·used·with260 Turns·on·auto-split·mode·when·used·with
267 .Fl·n261 \fB\-n\fP
268 or262 or
269 .Fl·p·.263 \fB\-p\fP.
270 In·auto-split·mode,·Ruby·executes264 In·auto-split·mode,·Ruby·executes
 265 .nf
271 .Dl·$F·=·$_.split266 \&··$F·=·$_.split
 267 .fi
272 at·beginning·of·each·loop.268 at·beginning·of·each·loop.
273 .Pp 
274 .It·Fl·c 
 269 .TP
 270 \fB\-c\fP
275 Causes·Ruby·to·check·the·syntax·of·the·script·and·exit·without271 Causes·Ruby·to·check·the·syntax·of·the·script·and·exit·without
276 executing.·If·there·are·no·syntax·errors,·Ruby·will·print272 executing.·If·there·are·no·syntax·errors,·Ruby·will·print
277 .Dq·Syntax·OK273 ``Syntax·OK''
278 to·the·standard·output.274 to·the·standard·output.
279 .Pp 
280 .It·Fl·d 
281 .It·Fl·-debug 
 275 .TP
 276 \fB\-d\fP
 277 .TP
 278 \fB\--debug\fP
282 Turns·on·debug·mode.279 Turns·on·debug·mode.
283 .Li·"$DEBUG"280 "$DEBUG"
284 will·be·set·to·true.281 will·be·set·to·true.
285 .Pp 
286 .It·Fl·e·Ar·command 
 282 .TP
 283 \fB\-e\fP·\fIcommand\fP
287 Specifies·script·from·command-line·while·telling·Ruby·not·to·search284 Specifies·script·from·command-line·while·telling·Ruby·not·to·search
288 the·rest·of·the·arguments·for·a·script·file·name.285 the·rest·of·the·arguments·for·a·script·file·name.
289 .Pp 
290 .It·Fl·h 
291 .It·Fl·-help 
 286 .TP
 287 \fB\-h\fP
 288 .TP
 289 \fB\--help\fP
292 Prints·a·summary·of·the·options.290 Prints·a·summary·of·the·options.
293 .Pp 
294 .It·Fl·i·Ar·extension 
 291 .TP
 292 \fB\-i\fP·\fIextension\fP
295 Specifies·in-place-edit·mode.··The·extension,·if·specified,·is·added293 Specifies·in-place-edit·mode.··The·extension,·if·specified,·is·added
296 to·old·file·name·to·make·a·backup·copy.··For·example:294 to·old·file·name·to·make·a·backup·copy.··For·example:
297 .Bd·-literal·-offset·indent 
298 %·echo·matz·>·/tmp/junk295 %·echo·matz·>·/tmp/junk
 296 .br
299 %·cat·/tmp/junk297 %·cat·/tmp/junk
 298 .br
300 matz299 matz
 300 .br
301 %·ruby·-p·-i.bak·-e·'$_.upcase!'·/tmp/junk301 %·ruby·-p·-i.bak·-e·'$_.upcase!'·/tmp/junk
 302 .br
302 %·cat·/tmp/junk303 %·cat·/tmp/junk
 304 .br
303 MATZ305 MATZ
 306 .br
304 %·cat·/tmp/junk.bak307 %·cat·/tmp/junk.bak
 308 .br
305 matz309 matz
306 .Ed 
307 .Pp 
308 .It·Fl·l310 .br
  
 311 .TP
 312 \fB\-l\fP
309 (The·lowercase·letter313 (The·lowercase·letter
310 .Dq·ell·.·)314 ``ell''.)
311 Enables·automatic·line-ending·processing,·which·means·to·firstly·set315 Enables·automatic·line-ending·processing,·which·means·to·firstly·set
312 .Li·"$\e"316 "$\e"
313 to·the·value·of317 to·the·value·of
314 .Li·"$/"·,318 "$/",
315 and·secondly·chops·every·line·read·using319 and·secondly·chops·every·line·read·using
316 .Li·chomp!·. 
317 .Pp 
318 .It·Fl·n320 chomp!.
  
 321 .TP
 322 \fB\-n\fP
319 Causes·Ruby·to·assume·the·following·loop·around·your·script,·which323 Causes·Ruby·to·assume·the·following·loop·around·your·script,·which
320 makes·it·iterate·over·file·name·arguments·somewhat·like324 makes·it·iterate·over·file·name·arguments·somewhat·like
321 .Nm·sed 
322 .Fl·n325 \fBsed\fP
 326 \fB\-n\fP
323 or327 or
324 .Nm·awk·. 
325 .Bd·-literal·-offset·indent328 \fBawk\fP.
  
326 while·gets329 while·gets
 330 .br
327 ··...331 ··...
 332 .br
328 end333 end
329 .Ed 
330 .Pp 
331 .It·Fl·p334 .br
  
 335 .TP
 336 \fB\-p\fP
332 Acts·mostly·same·as·-n·switch,·but·print·the·value·of·variable337 Acts·mostly·same·as·-n·switch,·but·print·the·value·of·variable
333 .Li·"$_"338 "$_"
334 at·the·each·end·of·the·loop.··For·example:339 at·the·each·end·of·the·loop.··For·example:
335 .Bd·-literal·-offset·indent 
336 %·echo·matz·|·ruby·-p·-e·'$_.tr!·"a-z",·"A-Z"'340 %·echo·matz·|·ruby·-p·-e·'$_.tr!·"a-z",·"A-Z"'
 341 .br
337 MATZ342 MATZ
338 .Ed 
339 .Pp 
340 .It·Fl·r·Ar·library343 .br
  
 344 .TP
 345 \fB\-r\fP·\fIlibrary\fP
341 Causes·Ruby·to·load·the·library·using·require.··It·is·useful·when·using346 Causes·Ruby·to·load·the·library·using·require.··It·is·useful·when·using
342 .Fl·n347 \fB\-n\fP
343 or348 or
344 .Fl·p·. 
345 .Pp 
346 .It·Fl·s349 \fB\-p\fP.
  
 350 .TP
 351 \fB\-s\fP
347 Enables·some·switch·parsing·for·switches·after·script·name·but·before352 Enables·some·switch·parsing·for·switches·after·script·name·but·before
348 any·file·name·arguments·(or·before·a353 any·file·name·arguments·(or·before·a
349 .Fl·-·)·.354 \fB\--\fP).
350 Any·switches·found·there·are·removed·from355 Any·switches·found·there·are·removed·from
351 .Li·ARGV356 ARGV
352 and·set·the·corresponding·variable·in·the·script.··For·example:357 and·set·the·corresponding·variable·in·the·script.··For·example:
353 .Bd·-literal·-offset·indent 
354 #!·/usr/local/bin/ruby·-s358 #!·/usr/local/bin/ruby·-s
 359 .br
355 #·prints·"true"·if·invoked·with·`-xyz'·switch.360 #·prints·"true"·if·invoked·with·`-xyz'·switch.
 361 .br
356 print·"true\en"·if·$xyz362 print·"true\en"·if·$xyz
357 .Ed 
358 .Pp 
359 .It·Fl·v363 .br
  
 364 .TP
 365 \fB\-v\fP
360 Enables·verbose·mode.··Ruby·will·print·its·version·at·the·beginning366 Enables·verbose·mode.··Ruby·will·print·its·version·at·the·beginning
361 and·set·the·variable367 and·set·the·variable
362 .Li·"$VERBOSE"368 "$VERBOSE"
363 to·true.··Some·methods·print·extra·messages·if·this·variable·is·true.369 to·true.··Some·methods·print·extra·messages·if·this·variable·is·true.
364 If·this·switch·is·given,·and·no·other·switches·are·present,·Ruby·quits370 If·this·switch·is·given,·and·no·other·switches·are·present,·Ruby·quits
365 after·printing·its·version.371 after·printing·its·version.
366 .Pp 
367 .It·Fl·w 
 372 .TP
 373 \fB\-w\fP
368 Enables·verbose·mode·without·printing·version·message·at·the374 Enables·verbose·mode·without·printing·version·message·at·the
369 beginning.··It·sets·the375 beginning.··It·sets·the
370 .Li·"$VERBOSE"376 "$VERBOSE"
371 variable·to·true.377 variable·to·true.
372 .Pp 
373 .It·Fl·x·Ns·Op·Ar·directory 
 378 .TP
 379 \fB\-x\fP[\fIdirectory\fP]
374 Tells·Ruby·that·the·script·is·embedded·in·a·message.··Leading·garbage380 Tells·Ruby·that·the·script·is·embedded·in·a·message.··Leading·garbage
375 will·be·discarded·until·the·first·line·that·starts·with381 will·be·discarded·until·the·first·line·that·starts·with
376 .Dq·#!382 ``#!''
377 and·contains·the·string,383 and·contains·the·string,
378 .Dq·ruby·.384 ``ruby''.
379 Any·meaningful·switches·on·that·line·will·be·applied.··The·end·of·the·script385 Any·meaningful·switches·on·that·line·will·be·applied.··The·end·of·the·script
380 must·be·specified·with·either386 must·be·specified·with·either
381 .Li·EOF·,387 EOF,
382 .Li·"^D"·(·Li·"control-D"·)·,388 "^D"·("control-D"),
383 .Li·"^Z"·(·Li·"control-Z"·)·,389 "^Z"·("control-Z"),
384 or·the·reserved·word390 or·the·reserved·word
385 .Li·__END__·.391 __END__.
386 If·the·directory·name·is·specified,·Ruby·will·switch·to·that·directory392 If·the·directory·name·is·specified,·Ruby·will·switch·to·that·directory
387 before·executing·script.393 before·executing·script.
388 .Pp 
389 .It·Fl·y 
390 .It·Fl·-yydebug 
 394 .TP
 395 \fB\-y\fP
 396 .TP
 397 \fB\--yydebug\fP
391 DO·NOT·USE.398 DO·NOT·USE.
392 .Pp 
393 Turns·on·compiler·debug·mode.··Ruby·will·print·a·bunch·of·internal399 Turns·on·compiler·debug·mode.··Ruby·will·print·a·bunch·of·internal
394 state·messages·during·compilation.··Only·specify·this·switch·you·are·going·to400 state·messages·during·compilation.··Only·specify·this·switch·you·are·going·to
395 debug·the·Ruby·interpreter.401 debug·the·Ruby·interpreter.
396 .Pp 
397 .It·Fl·-disable-·Ns·Ar·FEATURE 
398 .It·Fl·-enable-·Ns·Ar·FEATURE 
 402 .TP
 403 \fB\--disable-\fP\fIFEATURE\fP
 404 .TP
 405 \fB\--enable-\fP\fIFEATURE\fP
399 Disables·(or·enables)·the·specified406 Disables·(or·enables)·the·specified
400 .Ar·FEATURE·. 
401 .Bl·-tag·-width·"--disable-rubyopt"·-compact 
402 .It·Fl·-disable-gems 
403 .It·Fl·-enable-gems407 \fIFEATURE\fP.
 408 .TP
 409 \fB\--disable-gems\fP
 410 .TP
 411 \fB\--enable-gems\fP
404 Disables·(or·enables)·RubyGems·libraries.··By·default,·Ruby·will·load·the·latest412 Disables·(or·enables)·RubyGems·libraries.··By·default,·Ruby·will·load·the·latest
405 version·of·each·installed·gem.·The413 version·of·each·installed·gem.·The
406 .Li·Gem414 Gem
407 constant·is·true·if·RubyGems·is·enabled,·false·if·otherwise.415 constant·is·true·if·RubyGems·is·enabled,·false·if·otherwise.
408 .Pp 
409 .It·Fl·-disable-rubyopt 
410 .It·Fl·-enable-rubyopt 
 416 .TP
 417 \fB\--disable-rubyopt\fP
 418 .TP
 419 \fB\--enable-rubyopt\fP
411 Ignores·(or·considers)·the420 Ignores·(or·considers)·the
412 .Ev·RUBYOPT421 .IR·RUBYOPT
413 environment·variable.·By·default,·Ruby·considers·the·variable.422 environment·variable.·By·default,·Ruby·considers·the·variable.
414 .Pp 
415 .It·Fl·-disable-all 
416 .It·Fl·-enable-all 
 423 .TP
 424 \fB\--disable-all\fP
 425 .TP
 426 \fB\--enable-all\fP
417 Disables·(or·enables)·all·features.427 Disables·(or·enables)·all·features.
418 .Pp 
419 .El 
420 .Pp 
421 .It·Fl·-dump·Ns·=·Ns·Ar·target 
  
 428 .TP
 429 \fB\--dump\fP=\fItarget\fP
422 Dump·some·information.430 Dump·some·information.
423 .Pp 
424 Prints·the·specified·target.431 Prints·the·specified·target.
425 .Ar·target432 \fItarget\fP
426 can·be·one·of;433 can·be·one·of;
427 .Bl·-hang·-offset·indent434 .TP
428 .It·Sy·version435 .B·version
429 version·description·same·as436 version·description·same·as
430 .Fl·-version 
431 .It·Sy·usage437 \fB\--version\fP
 438 .TP
 439 .B·usage
432 brief·usage·message·same·as440 brief·usage·message·same·as
433 .Fl·h 
434 .It·Sy·help441 \fB\-h\fP
 442 .TP
 443 .B·help
435 Show·long·help·message·same·as444 Show·long·help·message·same·as
436 .Fl·-help 
437 .It·Sy·syntax445 \fB\--help\fP
 446 .TP
 447 .B·syntax
438 check·of·syntax·same·as448 check·of·syntax·same·as
439 .Fl·c449 \fB\-c\fP
 450 \fB\--yydebug\fP
 451 .TP
440 .Fl·-yydebug452 .B·yydebug
441 .It·Sy·yydebug 
442 compiler·debug·mode,·same·as453 compiler·debug·mode,·same·as
443 .Fl·-yydebug 
444 .Pp454 \fB\--yydebug\fP
  
445 Only·specify·this·switch·if·you·are·going·to·debug·the·Ruby·interpreter.455 Only·specify·this·switch·if·you·are·going·to·debug·the·Ruby·interpreter.
 456 .TP
446 .It·Sy·parsetree457 .B·parsetree
 458 .TP
447 .It·Sy·parsetree_with_comment459 .B·parsetree_with_comment
448 AST·nodes·tree460 AST·nodes·tree
449 .Pp 
450 Only·specify·this·switch·if·you·are·going·to·debug·the·Ruby·interpreter.461 Only·specify·this·switch·if·you·are·going·to·debug·the·Ruby·interpreter.
451 .It·Sy·insns462 .TP
 463 .B·insns
452 disassembled·instructions464 disassembled·instructions
453 .Pp 
454 Only·specify·this·switch·if·you·are·going·to·debug·the·Ruby·interpreter.465 Only·specify·this·switch·if·you·are·going·to·debug·the·Ruby·interpreter.
455 .El 
456 .Pp 
457 .It·Fl·-verbose 
 466 .TP
 467 \fB\--verbose\fP
458 Enables·verbose·mode·without·printing·version·message·at·the468 Enables·verbose·mode·without·printing·version·message·at·the
459 beginning.··It·sets·the469 beginning.··It·sets·the
460 .Li·"$VERBOSE"470 "$VERBOSE"
461 variable·to·true.471 variable·to·true.
462 If·this·switch·is·given,·and·no·script·arguments·(script·file·or472 If·this·switch·is·given,·and·no·script·arguments·(script·file·or
463 .Fl·e473 \fB\-e\fP
464 options)·are·present,·Ruby·quits·immediately.474 options)·are·present,·Ruby·quits·immediately.
  
465 .El 
466 .Pp 
467 .Sh·ENVIRONMENT475 .SH·ENVIRONMENT
468 .Bl·-tag·-width·"RUBYSHELL"·-compact476 .TP
469 .It·Ev·RUBYLIB477 .B·RUBYLIB
470 A·colon-separated·list·of·directories·that·are·added·to·Ruby's478 A·colon-separated·list·of·directories·that·are·added·to·Ruby's
471 library·load·path479 library·load·path
472 .Pf·(·Li·"$:"·)·.·Directories·from·this·environment·variable·are·searched480 ("$:").·Directories·from·this·environment·variable·are·searched
473 before·the·standard·load·path·is·searched.481 before·the·standard·load·path·is·searched.
474 .Pp 
475 e.g.:482 e.g.:
 483 .nf
476 .Dl·RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"484 \&··RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"
477 .Pp485 .fi
  
 486 .TP
478 .It·Ev·RUBYOPT487 .B·RUBYOPT
479 Additional·Ruby·options.488 Additional·Ruby·options.
480 .Pp 
481 e.g.489 e.g.
 490 .nf
482 .Dl·RUBYOPT="-w·-Ke"491 \&··RUBYOPT="-w·-Ke"
483 .Pp492 .fi
  
484 Note·that·RUBYOPT·can·contain·only493 Note·that·RUBYOPT·can·contain·only
485 .Fl·d·,·Fl·E·,·Fl·I·,·Fl·K·,·Fl·r·,·Fl·T·,·Fl·U·,·Fl·v·,·Fl·w·,·Fl·W,·Fl·-debug·, 
486 .Fl·-disable-·Ns·Ar·FEATURE494 \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,
 495 \fB\--disable-\fP\fIFEATURE\fP
487 and496 and
488 .Fl·-enable-·Ns·Ar·FEATURE·. 
489 .Pp497 \fB\--enable-\fP\fIFEATURE\fP.
  
 498 .TP
490 .It·Ev·RUBYPATH499 .B·RUBYPATH
491 A·colon-separated·list·of·directories·that·Ruby·searches·for500 A·colon-separated·list·of·directories·that·Ruby·searches·for
492 Ruby·programs·when·the501 Ruby·programs·when·the
493 .Fl·S502 \fB\-S\fP
494 flag·is·specified.··This·variable·precedes·the503 flag·is·specified.··This·variable·precedes·the
495 .Ev·PATH504 .IR·PATH
496 environment·variable.505 environment·variable.
497 .Pp 
 506 .TP
498 .It·Ev·RUBYSHELL507 .B·RUBYSHELL
499 The·path·to·the·system·shell·command.··This·environment·variable·is508 The·path·to·the·system·shell·command.··This·environment·variable·is
500 enabled·for·only·mswin32,·mingw32,·and·OS/2·platforms.··If·this509 enabled·for·only·mswin32,·mingw32,·and·OS/2·platforms.··If·this
501 variable·is·not·defined,·Ruby·refers·to510 variable·is·not·defined,·Ruby·refers·to
502 .Ev·COMSPEC·.511 .IR·COMSPEC.
503 .Pp 
504 .It·Ev·PATH 
 512 .TP
 513 .B·PATH
505 Ruby·refers·to·the514 Ruby·refers·to·the
506 .Ev·PATH515 .IR·PATH
507 environment·variable·on·calling·Kernel#system.516 environment·variable·on·calling·Kernel#system.
  
508 .El 
509 .Pp 
510 And·Ruby·depends·on·some·RubyGems·related·environment·variables·unless·RubyGems·is·disabled.517 And·Ruby·depends·on·some·RubyGems·related·environment·variables·unless·RubyGems·is·disabled.
511 See·the·help·of518 See·the·help·of
512 .Xr·gem·1519 \fBgem\fP(1)
513 as·below.520 as·below.
514 .Bd·-literal·-offset·indent 
515 %·gem·help521 %·gem·help
516 .Ed 
517 .Pp522 .br
  
518 .Sh·GC·ENVIRONMENT523 .SH·GC·ENVIRONMENT
519 The·Ruby·garbage·collector·(GC)·tracks·objects·in·fixed-sized·slots,524 The·Ruby·garbage·collector·(GC)·tracks·objects·in·fixed-sized·slots,
520 but·each·object·may·have·auxiliary·memory·allocations·handled·by·the525 but·each·object·may·have·auxiliary·memory·allocations·handled·by·the
521 malloc·family·of·C·standard·library·calls·(526 malloc·family·of·C·standard·library·calls·(
522 .Xr·malloc·3·, 
523 .Xr·calloc·3·,527 \fBmalloc\fP(3),
 528 \fBcalloc\fP(3),
524 and529 and
525 .Xr·realloc·3·)·.530 \fBrealloc\fP(3))
526 In·this·documentatation,·the·"heap"·refers·to·the·Ruby·object·heap531 In·this·documentatation,·the·"heap"·refers·to·the·Ruby·object·heap
527 of·fixed-sized·slots,·while·"malloc"·refers·to·auxiliary532 of·fixed-sized·slots,·while·"malloc"·refers·to·auxiliary
528 allocations·commonly·referred·to·as·the·"process·heap".533 allocations·commonly·referred·to·as·the·"process·heap".
529 Thus·there·are·at·least·two·possible·ways·to·trigger·GC:534 Thus·there·are·at·least·two·possible·ways·to·trigger·GC:
530 .Bl·-hang·-offset·indent 
531 .It·Sy·1535 .TP
 536 .B·1
532 Reaching·the·object·limit.537 Reaching·the·object·limit.
533 .It·Sy·2538 .TP
 539 .B·2
534 Reaching·the·malloc·limit.540 Reaching·the·malloc·limit.
  
535 .Pp 
536 .El 
537 In·Ruby·2.1,·the·generational·GC·was·introduced·and·the·limits·are·divided541 In·Ruby·2.1,·the·generational·GC·was·introduced·and·the·limits·are·divided
538 into·young·and·old·generations,·providing·two·additional·ways·to·trigger542 into·young·and·old·generations,·providing·two·additional·ways·to·trigger
539 a·GC:543 a·GC:
540 .Bl·-hang·-offset·indent 
541 .It·Sy·3544 .TP
 545 .B·3
542 Reaching·the·old·object·limit.546 Reaching·the·old·object·limit.
543 .It·Sy·4547 .TP
 548 .B·4
544 Reaching·the·old·malloc·limit.549 Reaching·the·old·malloc·limit.
  
545 .El 
546 .Pp 
547 There·are·currently·4·possible·areas·where·the·GC·may·be·tuned·by550 There·are·currently·4·possible·areas·where·the·GC·may·be·tuned·by
548 the·following·11·environment·variables:551 the·following·11·environment·variables:
549 .Bl·-hang·-compact·-width·"RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR"552 .TP
550 .It·Ev·RUBY_GC_HEAP_INIT_SLOTS553 .B·RUBY_GC_HEAP_INIT_SLOTS
551 Initial·allocation·slots.··Introduced·in·Ruby·2.1,·default:·10000.554 Initial·allocation·slots.··Introduced·in·Ruby·2.1,·default:·10000.
552 .Pp 
 555 .TP
553 .It·Ev·RUBY_GC_HEAP_FREE_SLOTS556 .B·RUBY_GC_HEAP_FREE_SLOTS
554 Prepare·at·least·this·amount·of·slots·after·GC.557 Prepare·at·least·this·amount·of·slots·after·GC.
555 Allocate·this·number·slots·if·there·are·not·enough·slots.558 Allocate·this·number·slots·if·there·are·not·enough·slots.
556 Introduced·in·Ruby·2.1,·default:·4096559 Introduced·in·Ruby·2.1,·default:·4096
557 .Pp 
 560 .TP
558 .It·Ev·RUBY_GC_HEAP_GROWTH_FACTOR561 .B·RUBY_GC_HEAP_GROWTH_FACTOR
559 Increase·allocation·rate·of·heap·slots·by·this·factor.562 Increase·allocation·rate·of·heap·slots·by·this·factor.
560 Introduced·in·Ruby·2.1,·default:·1.8,·minimum:·1.0·(no·growth)563 Introduced·in·Ruby·2.1,·default:·1.8,·minimum:·1.0·(no·growth)
561 .Pp 
 564 .TP
562 .It·Ev·RUBY_GC_HEAP_GROWTH_MAX_SLOTS565 .B·RUBY_GC_HEAP_GROWTH_MAX_SLOTS
563 Allocation·rate·is·limited·to·this·number·of·slots,566 Allocation·rate·is·limited·to·this·number·of·slots,
564 preventing·excessive·allocation·due·to·RUBY_GC_HEAP_GROWTH_FACTOR.567 preventing·excessive·allocation·due·to·RUBY_GC_HEAP_GROWTH_FACTOR.
565 Introduced·in·Ruby·2.1,·default:·0·(no·limit)568 Introduced·in·Ruby·2.1,·default:·0·(no·limit)
566 .Pp 
 569 .TP
567 .It·Ev·RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR570 .B·RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR
568 Perform·a·full·GC·when·the·number·of·old·objects·is·more·than·R·*·N,571 Perform·a·full·GC·when·the·number·of·old·objects·is·more·than·R·*·N,
569 where·R·is·this·factor·and·N·is·the·number·of·old·objects·after·the572 where·R·is·this·factor·and·N·is·the·number·of·old·objects·after·the
570 last·full·GC.573 last·full·GC.
571 Introduced·in·Ruby·2.1.1,·default:·2.0574 Introduced·in·Ruby·2.1.1,·default:·2.0
572 .Pp 
 575 .TP
573 .It·Ev·RUBY_GC_MALLOC_LIMIT576 .B·RUBY_GC_MALLOC_LIMIT
574 The·initial·limit·of·young·generation·allocation·from·the·malloc-family.577 The·initial·limit·of·young·generation·allocation·from·the·malloc-family.
575 GC·will·start·when·this·limit·is·reached.578 GC·will·start·when·this·limit·is·reached.
576 Default:·16MB579 Default:·16MB
577 .Pp 
 580 .TP
578 .It·Ev·RUBY_GC_MALLOC_LIMIT_MAX581 .B·RUBY_GC_MALLOC_LIMIT_MAX
579 The·maximum·limit·of·young·generation·allocation·from·malloc·before·GC·starts.582 The·maximum·limit·of·young·generation·allocation·from·malloc·before·GC·starts.
580 Prevents·excessive·malloc·growth·due·to·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.583 Prevents·excessive·malloc·growth·due·to·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR.
581 Introduced·in·Ruby·2.1,·default:·32MB.584 Introduced·in·Ruby·2.1,·default:·32MB.
582 .Pp 
 585 .TP
583 .It·Ev·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR586 .B·RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
584 Increases·the·limit·of·young·generation·malloc·calls,·reducing587 Increases·the·limit·of·young·generation·malloc·calls,·reducing
585 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_MALLOC_LIMIT_MAX588 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_MALLOC_LIMIT_MAX
586 is·reached.589 is·reached.
587 Introduced·in·Ruby·2.1,·default:·1.4,·minimum:·1.0·(no·growth)590 Introduced·in·Ruby·2.1,·default:·1.4,·minimum:·1.0·(no·growth)
588 .Pp 
 591 .TP
589 .It·Ev·RUBY_GC_OLDMALLOC_LIMIT592 .B·RUBY_GC_OLDMALLOC_LIMIT
590 The·initial·limit·of·old·generation·allocation·from·malloc,593 The·initial·limit·of·old·generation·allocation·from·malloc,
591 a·full·GC·will·start·when·this·limit·is·reached.594 a·full·GC·will·start·when·this·limit·is·reached.
592 Introduced·in·Ruby·2.1,·default:·16MB595 Introduced·in·Ruby·2.1,·default:·16MB
593 .Pp 
 596 .TP
594 .It·Ev·RUBY_GC_OLDMALLOC_LIMIT_MAX597 .B·RUBY_GC_OLDMALLOC_LIMIT_MAX
595 The·maximum·limit·of·old·generation·allocation·from·malloc·before·a598 The·maximum·limit·of·old·generation·allocation·from·malloc·before·a
596 full·GC·starts.599 full·GC·starts.
597 Prevents·excessive·malloc·growth·due·to·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR.600 Prevents·excessive·malloc·growth·due·to·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR.
598 Introduced·in·Ruby·2.1,·default:·128MB601 Introduced·in·Ruby·2.1,·default:·128MB
599 .Pp 
 602 .TP
600 .It·Ev·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR603 .B·RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
601 Increases·the·limit·of·old·generation·malloc·allocation,·reducing·full604 Increases·the·limit·of·old·generation·malloc·allocation,·reducing·full
602 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_OLDMALLOC_LIMIT_MAX605 GC·frequency·but·increasing·malloc·growth·until·RUBY_GC_OLDMALLOC_LIMIT_MAX
603 is·reached.606 is·reached.
604 Introduced·in·Ruby·2.1,·default:·1.2,·minimum:·1.0·(no·growth)607 Introduced·in·Ruby·2.1,·default:·1.2,·minimum:·1.0·(no·growth)
  
605 .Pp 
606 .El 
607 .Sh·STACK·SIZE·ENVIRONMENT608 .SH·STACK·SIZE·ENVIRONMENT
608 Stack·size·environment·variables·are·implementation-dependent·and609 Stack·size·environment·variables·are·implementation-dependent·and
609 subject·to·change·with·different·versions·of·Ruby.··The·VM·stack·is·used610 subject·to·change·with·different·versions·of·Ruby.··The·VM·stack·is·used
610 for·pure-Ruby·code·and·managed·by·the·virtual·machine.··Machine·stack·is611 for·pure-Ruby·code·and·managed·by·the·virtual·machine.··Machine·stack·is
611 used·by·the·operating·system·and·its·usage·is·dependent·on·C·extensions612 used·by·the·operating·system·and·its·usage·is·dependent·on·C·extensions
612 as·well·as·C·compiler·options.··Using·lower·values·for·these·may·allow613 as·well·as·C·compiler·options.··Using·lower·values·for·these·may·allow
613 applications·to·keep·more·Fibers·or·Threads·running;·but·increases·the614 applications·to·keep·more·Fibers·or·Threads·running;·but·increases·the
614 chance·of·SystemStackError·exceptions·and·segmentation·faults·(SIGSEGV).615 chance·of·SystemStackError·exceptions·and·segmentation·faults·(SIGSEGV).
615 These·environment·variables·are·available·since·Ruby·2.0.0.616 These·environment·variables·are·available·since·Ruby·2.0.0.
616 All·values·are·specified·in·bytes.617 All·values·are·specified·in·bytes.
617 .Pp 
618 .Bl·-hang·-compact·-width·"RUBY_THREAD_MACHINE_STACK_SIZE" 
 618 .TP
619 .It·Ev·RUBY_THREAD_VM_STACK_SIZE619 .B·RUBY_THREAD_VM_STACK_SIZE
620 VM·stack·size·used·at·thread·creation.620 VM·stack·size·used·at·thread·creation.
621 default:·524288·(32-bit·CPU)·or·1048575·(64-bit)621 default:·524288·(32-bit·CPU)·or·1048575·(64-bit)
622 .Pp 
 622 .TP
623 .It·Ev·RUBY_THREAD_MACHINE_STACK_SIZE623 .B·RUBY_THREAD_MACHINE_STACK_SIZE
624 Machine·stack·size·used·at·thread·creation.624 Machine·stack·size·used·at·thread·creation.
625 default:·524288·or·1048575625 default:·524288·or·1048575
626 .Pp 
 626 .TP
627 .It·Ev·RUBY_FIBER_VM_STACK_SIZE627 .B·RUBY_FIBER_VM_STACK_SIZE
628 VM·stack·size·used·at·fiber·creation.628 VM·stack·size·used·at·fiber·creation.
629 default:·65536·or·131072629 default:·65536·or·131072
630 .Pp 
 630 .TP
631 .It·Ev·RUBY_FIBER_MACHINE_STACK_SIZE631 .B·RUBY_FIBER_MACHINE_STACK_SIZE
632 Machine·stack·size·used·at·fiber·creation.632 Machine·stack·size·used·at·fiber·creation.
633 default:·262144·or·524288633 default:·262144·or·524288
  
634 .Pp 
635 .El 
636 .Sh·SEE·ALSO634 .SH·SEE·ALSO
637 .Bl·-hang·-compact·-width·"https://www.ruby-toolbox.com/"635 .TP
638 .It·Lk·https://www.ruby-lang.org/636 .B·https://www.ruby-lang.org/
639 The·official·web·site.637 The·official·web·site.
 638 .TP
640 .It·Lk·https://www.ruby-toolbox.com/639 .B·https://www.ruby-toolbox.com/
641 Comprehensive·catalog·of·Ruby·libraries.640 Comprehensive·catalog·of·Ruby·libraries.
  
642 .El 
643 .Pp 
644 .Sh·REPORTING·BUGS641 .SH·REPORTING·BUGS
 642 .IP·\(bu
645 .Bl·-bullet 
646 .It 
647 Security·vulnerabilities·should·be·reported·via·an·email·to643 Security·vulnerabilities·should·be·reported·via·an·email·to
648 .Mt·security@ruby-lang.org·.644 Mt·security@ruby-lang.org.
649 Reported·problems·will·be·published·after·being·fixed.645 Reported·problems·will·be·published·after·being·fixed.
650 .Pp 
651 .It 
 646 .IP·\(bu
652 Other·bugs·and·feature·requests·can·be·reported·via·the647 Other·bugs·and·feature·requests·can·be·reported·via·the
653 Ruby·Issue·Tracking·System648 Ruby·Issue·Tracking·System
654 .Pq·Lk·https://bugs.ruby-lang.org/·.649 (\fBhttps://bugs.ruby-lang.org/\fP).
655 Do·not·report·security·vulnerabilities650 Do·not·report·security·vulnerabilities
656 via·this·system·because·it·publishes·the·vulnerabilities·immediately.651 via·this·system·because·it·publishes·the·vulnerabilities·immediately.
657 .El 
658 .Sh·AUTHORS652 .SH·AUTHORS
659 Ruby·is·designed·and·implemented·by653 Ruby·is·designed·and·implemented·by
660 .An·Yukihiro·Matsumoto·Aq·matz@netlab.jp·.654 Yukihiro·Matsumoto·<matz@netlab.jp>.
661 .Pp 
662 See655 See
663 .Aq·Lk·https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors656 <\fBhttps://bugs.ruby-lang.org/projects/ruby/wiki/Contributors\fP>
664 for·contributors·to·Ruby.657 for·contributors·to·Ruby.