rbs 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- data/lib/rbs/location.rb +0 -221
data/core/env.rbs
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# <!-- rdoc-file=hash.c -->
|
1
2
|
# ENV is a hash-like accessor for environment variables.
|
2
3
|
#
|
3
4
|
# ### Interaction with the Operating System
|
@@ -85,9 +86,182 @@
|
|
85
86
|
# * ENV.replace replaces ENV with a new collection of entries.
|
86
87
|
# * ENV.clear empties ENV.
|
87
88
|
#
|
89
|
+
#
|
90
|
+
# ## What's Here
|
91
|
+
#
|
92
|
+
# First, what's elsewhere. Class ENV:
|
93
|
+
#
|
94
|
+
# * Inherits from [class
|
95
|
+
# Object](Object.html#class-Object-label-What-27s+Here).
|
96
|
+
# * Extends [module
|
97
|
+
# Enumerable](Enumerable.html#module-Enumerable-label-What-27s+Here),
|
98
|
+
#
|
99
|
+
#
|
100
|
+
# Here, class ENV provides methods that are useful for:
|
101
|
+
#
|
102
|
+
# * [Querying](#class-ENV-label-Methods+for+Querying)
|
103
|
+
# * [Assigning](#class-ENV-label-Methods+for+Assigning)
|
104
|
+
# * [Deleting](#class-ENV-label-Methods+for+Deleting)
|
105
|
+
# * [Iterating](#class-ENV-label-Methods+for+Iterating)
|
106
|
+
# * [Converting](#class-ENV-label-Methods+for+Converting)
|
107
|
+
# * [And more ....](#class-ENV-label-More+Methods)
|
108
|
+
#
|
109
|
+
#
|
110
|
+
# ### Methods for Querying
|
111
|
+
#
|
112
|
+
# ::[]
|
113
|
+
# : Returns the value for the given environment variable name if it
|
114
|
+
# exists:
|
115
|
+
#
|
116
|
+
# ::empty?
|
117
|
+
# : Returns whether ENV is empty.
|
118
|
+
#
|
119
|
+
# ::has_value?, ::value?
|
120
|
+
# : Returns whether the given value is in ENV.
|
121
|
+
#
|
122
|
+
# ::include?, ::has_key?, ::key?, ::member?
|
123
|
+
# : Returns whether the given name is in ENV.
|
124
|
+
#
|
125
|
+
# ::key
|
126
|
+
# : Returns the name of the first entry with the given value.
|
127
|
+
#
|
128
|
+
# ::size, ::length
|
129
|
+
# : Returns the number of entries.
|
130
|
+
#
|
131
|
+
# ::value?
|
132
|
+
# : Returns whether any entry has the given value.
|
133
|
+
#
|
134
|
+
#
|
135
|
+
#
|
136
|
+
# ### Methods for Assigning
|
137
|
+
#
|
138
|
+
# ::[]=, ::store
|
139
|
+
# : Creates, updates, or deletes the named environment variable.
|
140
|
+
#
|
141
|
+
# ::clear
|
142
|
+
# : Removes every environment variable; returns ENV:
|
143
|
+
#
|
144
|
+
# ::update, ::merge!
|
145
|
+
# : Adds to ENV each key/value pair in the given hash.
|
146
|
+
#
|
147
|
+
# ::replace
|
148
|
+
# : Replaces the entire content of the ENV with the name/value pairs in
|
149
|
+
# the given hash.
|
150
|
+
#
|
151
|
+
#
|
152
|
+
#
|
153
|
+
# ### Methods for Deleting
|
154
|
+
#
|
155
|
+
# ::delete
|
156
|
+
# : Deletes the named environment variable name if it exists.
|
157
|
+
#
|
158
|
+
# ::delete_if
|
159
|
+
# : Deletes entries selected by the block.
|
160
|
+
#
|
161
|
+
# ::keep_if
|
162
|
+
# : Deletes entries not selected by the block.
|
163
|
+
#
|
164
|
+
# ::reject!
|
165
|
+
# : Similar to #delete_if, but returns `nil` if no change was made.
|
166
|
+
#
|
167
|
+
# ::select!, ::filter!
|
168
|
+
# : Deletes entries selected by the block.
|
169
|
+
#
|
170
|
+
# ::shift
|
171
|
+
# : Removes and returns the first entry.
|
172
|
+
#
|
173
|
+
#
|
174
|
+
#
|
175
|
+
# ### Methods for Iterating
|
176
|
+
#
|
177
|
+
# ::each, ::each_pair
|
178
|
+
# : Calls the block with each name/value pair.
|
179
|
+
#
|
180
|
+
# ::each_key
|
181
|
+
# : Calls the block with each name.
|
182
|
+
#
|
183
|
+
# ::each_value
|
184
|
+
# : Calls the block with each value.
|
185
|
+
#
|
186
|
+
#
|
187
|
+
#
|
188
|
+
# ### Methods for Converting
|
189
|
+
#
|
190
|
+
# ::assoc
|
191
|
+
# : Returns a 2-element array containing the name and value of the named
|
192
|
+
# environment variable if it exists:
|
193
|
+
#
|
194
|
+
# ::clone
|
195
|
+
# : Returns ENV (and issues a warning).
|
196
|
+
#
|
197
|
+
# ::except
|
198
|
+
# : Returns a hash of all name/value pairs except those given.
|
199
|
+
#
|
200
|
+
# ::fetch
|
201
|
+
# : Returns the value for the given name.
|
202
|
+
#
|
203
|
+
# ::inspect
|
204
|
+
# : Returns the contents of ENV as a string.
|
205
|
+
#
|
206
|
+
# ::invert
|
207
|
+
# : Returns a hash whose keys are the ENV values, and whose values are the
|
208
|
+
# corresponding ENV names.
|
209
|
+
#
|
210
|
+
# ::keys
|
211
|
+
# : Returns an array of all names.
|
212
|
+
#
|
213
|
+
# ::rassoc
|
214
|
+
# : Returns the name and value of the first found entry that has the given
|
215
|
+
# value.
|
216
|
+
#
|
217
|
+
# ::reject
|
218
|
+
# : Returns a hash of those entries not rejected by the block.
|
219
|
+
#
|
220
|
+
# ::select, ::filter
|
221
|
+
# : Returns a hash of name/value pairs selected by the block.
|
222
|
+
#
|
223
|
+
# ::slice
|
224
|
+
# : Returns a hash of the given names and their corresponding values.
|
225
|
+
#
|
226
|
+
# ::to_a
|
227
|
+
# : Returns the entries as an array of 2-element Arrays.
|
228
|
+
#
|
229
|
+
# ::to_h
|
230
|
+
# : Returns a hash of entries selected by the block.
|
231
|
+
#
|
232
|
+
# ::to_hash
|
233
|
+
# : Returns a hash of all entries.
|
234
|
+
#
|
235
|
+
# ::to_s
|
236
|
+
# : Returns the string `'ENV'`.
|
237
|
+
#
|
238
|
+
# ::values
|
239
|
+
# : Returns all values as an array.
|
240
|
+
#
|
241
|
+
# ::values_at
|
242
|
+
# : Returns an array of the values for the given name.
|
243
|
+
#
|
244
|
+
#
|
245
|
+
#
|
246
|
+
# ### More Methods
|
247
|
+
#
|
248
|
+
# ::dup
|
249
|
+
# : Raises an exception.
|
250
|
+
#
|
251
|
+
# ::freeze
|
252
|
+
# : Raises an exception.
|
253
|
+
#
|
254
|
+
# ::rehash
|
255
|
+
# : Returns `nil`, without modifying ENV.
|
256
|
+
#
|
257
|
+
%a{annotate:rdoc:copy:ENV}
|
88
258
|
class ENVClass
|
89
259
|
include Enumerable[[ String, String ]]
|
90
260
|
|
261
|
+
# <!--
|
262
|
+
# rdoc-file=hash.c
|
263
|
+
# - ENV[name] -> value
|
264
|
+
# -->
|
91
265
|
# Returns the value for the environment variable `name` if it exists:
|
92
266
|
# ENV['foo'] = '0'
|
93
267
|
# ENV['foo'] # => "0"
|
@@ -97,8 +271,15 @@ class ENVClass
|
|
97
271
|
# Raises an exception if `name` is invalid. See [Invalid Names and
|
98
272
|
# Values](#class-ENV-label-Invalid+Names+and+Values).
|
99
273
|
#
|
274
|
+
%a{annotate:rdoc:copy:ENV.[]}
|
100
275
|
def []: (String name) -> String?
|
101
276
|
|
277
|
+
# <!--
|
278
|
+
# rdoc-file=hash.c
|
279
|
+
# - ENV.fetch(name) -> value
|
280
|
+
# - ENV.fetch(name, default) -> value
|
281
|
+
# - ENV.fetch(name) { |name| block } -> value
|
282
|
+
# -->
|
102
283
|
# If `name` is the name of an environment variable, returns its value:
|
103
284
|
# ENV['foo'] = '0'
|
104
285
|
# ENV.fetch('foo') # => '0'
|
@@ -124,10 +305,16 @@ class ENVClass
|
|
124
305
|
# Raises an exception if `name` is invalid. See [Invalid Names and
|
125
306
|
# Values](#class-ENV-label-Invalid+Names+and+Values).
|
126
307
|
#
|
308
|
+
%a{annotate:rdoc:copy:ENV.fetch}
|
127
309
|
def fetch: (String name) -> String
|
128
310
|
| [X] (String name, X default) -> (String | X)
|
129
311
|
| [X] (String name) { (String) -> X } -> (String | X)
|
130
312
|
|
313
|
+
# <!--
|
314
|
+
# rdoc-file=hash.c
|
315
|
+
# - ENV[name] = value -> value
|
316
|
+
# - ENV.store(name, value) -> value
|
317
|
+
# -->
|
131
318
|
# ENV.store is an alias for ENV.[]=.
|
132
319
|
#
|
133
320
|
# Creates, updates, or deletes the named environment variable, returning the
|
@@ -175,8 +362,14 @@ class ENVClass
|
|
175
362
|
# Raises an exception if `name` or `value` is invalid. See [Invalid Names and
|
176
363
|
# Values](#class-ENV-label-Invalid+Names+and+Values).
|
177
364
|
#
|
365
|
+
%a{annotate:rdoc:copy:ENV.[]=}
|
178
366
|
def []=: (String name, String? value) -> String?
|
179
367
|
|
368
|
+
# <!--
|
369
|
+
# rdoc-file=hash.c
|
370
|
+
# - ENV[name] = value -> value
|
371
|
+
# - ENV.store(name, value) -> value
|
372
|
+
# -->
|
180
373
|
# ENV.store is an alias for ENV.[]=.
|
181
374
|
#
|
182
375
|
# Creates, updates, or deletes the named environment variable, returning the
|
@@ -224,8 +417,16 @@ class ENVClass
|
|
224
417
|
# Raises an exception if `name` or `value` is invalid. See [Invalid Names and
|
225
418
|
# Values](#class-ENV-label-Invalid+Names+and+Values).
|
226
419
|
#
|
420
|
+
%a{annotate:rdoc:copy:ENV.store}
|
227
421
|
alias store []=
|
228
422
|
|
423
|
+
# <!--
|
424
|
+
# rdoc-file=hash.c
|
425
|
+
# - ENV.each { |name, value| block } -> ENV
|
426
|
+
# - ENV.each -> an_enumerator
|
427
|
+
# - ENV.each_pair { |name, value| block } -> ENV
|
428
|
+
# - ENV.each_pair -> an_enumerator
|
429
|
+
# -->
|
229
430
|
# Yields each environment variable name and its value as a 2-element Array:
|
230
431
|
# h = {}
|
231
432
|
# ENV.each_pair { |name, value| h[name] = value } # => ENV
|
@@ -237,9 +438,17 @@ class ENVClass
|
|
237
438
|
# e.each { |name, value| h[name] = value } # => ENV
|
238
439
|
# h # => {"bar"=>"1", "foo"=>"0"}
|
239
440
|
#
|
441
|
+
%a{annotate:rdoc:copy:ENV.each}
|
240
442
|
def each: () -> ::Enumerator[[ String, String ], self]
|
241
443
|
| () { ([ String, String ]) -> void } -> self
|
242
444
|
|
445
|
+
# <!--
|
446
|
+
# rdoc-file=hash.c
|
447
|
+
# - ENV.each { |name, value| block } -> ENV
|
448
|
+
# - ENV.each -> an_enumerator
|
449
|
+
# - ENV.each_pair { |name, value| block } -> ENV
|
450
|
+
# - ENV.each_pair -> an_enumerator
|
451
|
+
# -->
|
243
452
|
# Yields each environment variable name and its value as a 2-element Array:
|
244
453
|
# h = {}
|
245
454
|
# ENV.each_pair { |name, value| h[name] = value } # => ENV
|
@@ -251,9 +460,15 @@ class ENVClass
|
|
251
460
|
# e.each { |name, value| h[name] = value } # => ENV
|
252
461
|
# h # => {"bar"=>"1", "foo"=>"0"}
|
253
462
|
#
|
463
|
+
%a{annotate:rdoc:copy:ENV.each_pair}
|
254
464
|
def each_pair: () -> ::Enumerator[[ String, String ], self]
|
255
465
|
| () { ([ String, String ]) -> void } -> self
|
256
466
|
|
467
|
+
# <!--
|
468
|
+
# rdoc-file=hash.c
|
469
|
+
# - ENV.each_key { |name| block } -> ENV
|
470
|
+
# - ENV.each_key -> an_enumerator
|
471
|
+
# -->
|
257
472
|
# Yields each environment variable name:
|
258
473
|
# ENV.replace('foo' => '0', 'bar' => '1') # => ENV
|
259
474
|
# names = []
|
@@ -266,9 +481,15 @@ class ENVClass
|
|
266
481
|
# e.each { |name| names.push(name) } # => ENV
|
267
482
|
# names # => ["bar", "foo"]
|
268
483
|
#
|
484
|
+
%a{annotate:rdoc:copy:ENV.each_key}
|
269
485
|
def each_key: () -> ::Enumerator[[ String ], self]
|
270
486
|
| () { (String name) -> void } -> self
|
271
487
|
|
488
|
+
# <!--
|
489
|
+
# rdoc-file=hash.c
|
490
|
+
# - ENV.each_value { |value| block } -> ENV
|
491
|
+
# - ENV.each_value -> an_enumerator
|
492
|
+
# -->
|
272
493
|
# Yields each environment variable value:
|
273
494
|
# ENV.replace('foo' => '0', 'bar' => '1') # => ENV
|
274
495
|
# values = []
|
@@ -281,9 +502,17 @@ class ENVClass
|
|
281
502
|
# e.each { |value| values.push(value) } # => ENV
|
282
503
|
# values # => ["1", "0"]
|
283
504
|
#
|
505
|
+
%a{annotate:rdoc:copy:ENV.each_value}
|
284
506
|
def each_value: () -> ::Enumerator[[ String ], self]
|
285
507
|
| () { (String value) -> void } -> self
|
286
508
|
|
509
|
+
# <!--
|
510
|
+
# rdoc-file=hash.c
|
511
|
+
# - ENV.delete(name) -> value
|
512
|
+
# - ENV.delete(name) { |name| block } -> value
|
513
|
+
# - ENV.delete(missing_name) -> nil
|
514
|
+
# - ENV.delete(missing_name) { |name| block } -> block_value
|
515
|
+
# -->
|
287
516
|
# Deletes the environment variable with `name` if it exists and returns its
|
288
517
|
# value:
|
289
518
|
# ENV['foo'] = '0'
|
@@ -304,9 +533,15 @@ class ENVClass
|
|
304
533
|
# Raises an exception if `name` is invalid. See [Invalid Names and
|
305
534
|
# Values](#class-ENV-label-Invalid+Names+and+Values).
|
306
535
|
#
|
536
|
+
%a{annotate:rdoc:copy:ENV.delete}
|
307
537
|
def delete: (String name) -> String?
|
308
538
|
| (String name) { (String) -> String } -> String
|
309
539
|
|
540
|
+
# <!--
|
541
|
+
# rdoc-file=hash.c
|
542
|
+
# - ENV.delete_if { |name, value| block } -> ENV
|
543
|
+
# - ENV.delete_if -> an_enumerator
|
544
|
+
# -->
|
310
545
|
# Yields each environment variable name and its value as a 2-element Array,
|
311
546
|
# deleting each environment variable for which the block returns a truthy value,
|
312
547
|
# and returning ENV (regardless of whether any deletions):
|
@@ -322,9 +557,15 @@ class ENVClass
|
|
322
557
|
# ENV # => {"foo"=>"0"}
|
323
558
|
# e.each { |name, value| name.start_with?('b') } # => ENV
|
324
559
|
#
|
560
|
+
%a{annotate:rdoc:copy:ENV.delete_if}
|
325
561
|
def delete_if: () -> ::Enumerator[[ String, String ], self]
|
326
562
|
| () { (String name, String value) -> boolish } -> self
|
327
563
|
|
564
|
+
# <!--
|
565
|
+
# rdoc-file=hash.c
|
566
|
+
# - ENV.keep_if { |name, value| block } -> ENV
|
567
|
+
# - ENV.keep_if -> an_enumerator
|
568
|
+
# -->
|
328
569
|
# Yields each environment variable name and its value as a 2-element Array,
|
329
570
|
# deleting each environment variable for which the block returns `false` or
|
330
571
|
# `nil`, and returning ENV:
|
@@ -338,9 +579,14 @@ class ENVClass
|
|
338
579
|
# e.each { |name, value| name.start_with?('b') } # => ENV
|
339
580
|
# ENV # => {"bar"=>"1", "baz"=>"2"}
|
340
581
|
#
|
582
|
+
%a{annotate:rdoc:copy:ENV.keep_if}
|
341
583
|
def keep_if: () -> ::Enumerator[[ String, String ], self]
|
342
584
|
| () { (String name, String value) -> boolish } -> self
|
343
585
|
|
586
|
+
# <!--
|
587
|
+
# rdoc-file=hash.c
|
588
|
+
# - ENV.slice(*names) -> hash of name/value pairs
|
589
|
+
# -->
|
344
590
|
# Returns a Hash of the given ENV names and their corresponding values:
|
345
591
|
# ENV.replace('foo' => '0', 'bar' => '1', 'baz' => '2', 'bat' => '3')
|
346
592
|
# ENV.slice('foo', 'baz') # => {"foo"=>"0", "baz"=>"2"}
|
@@ -350,23 +596,39 @@ class ENVClass
|
|
350
596
|
# Values](#class-ENV-label-Invalid+Names+and+Values)):
|
351
597
|
# ENV.slice('foo', 'bar', :bat) # Raises TypeError (no implicit conversion of Symbol into String)
|
352
598
|
#
|
599
|
+
%a{annotate:rdoc:copy:ENV.slice}
|
353
600
|
def slice: (*String names) -> ::Hash[String, String]
|
354
601
|
|
602
|
+
# <!--
|
603
|
+
# rdoc-file=hash.c
|
604
|
+
# - ENV.except(*keys) -> a_hash
|
605
|
+
# -->
|
355
606
|
# Returns a hash except the given keys from ENV and their values.
|
356
607
|
#
|
357
608
|
# ENV #=> {"LANG"=>"en_US.UTF-8", "TERM"=>"xterm-256color", "HOME"=>"/Users/rhc"}
|
358
609
|
# ENV.except("TERM","HOME") #=> {"LANG"=>"en_US.UTF-8"}
|
359
610
|
#
|
611
|
+
%a{annotate:rdoc:copy:ENV.except}
|
360
612
|
def except: (*String names) -> ::Hash[String, String]
|
361
613
|
|
614
|
+
# <!--
|
615
|
+
# rdoc-file=hash.c
|
616
|
+
# - ENV.clear -> ENV
|
617
|
+
# -->
|
362
618
|
# Removes every environment variable; returns ENV:
|
363
619
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
364
620
|
# ENV.size # => 2
|
365
621
|
# ENV.clear # => ENV
|
366
622
|
# ENV.size # => 0
|
367
623
|
#
|
624
|
+
%a{annotate:rdoc:copy:ENV.clear}
|
368
625
|
def clear: () -> self
|
369
626
|
|
627
|
+
# <!--
|
628
|
+
# rdoc-file=hash.c
|
629
|
+
# - ENV.reject { |name, value| block } -> hash of name/value pairs
|
630
|
+
# - ENV.reject -> an_enumerator
|
631
|
+
# -->
|
370
632
|
# Yields each environment variable name and its value as a 2-element Array.
|
371
633
|
# Returns a Hash whose items are determined by the block. When the block returns
|
372
634
|
# a truthy value, the name/value pair is added to the return Hash; otherwise the
|
@@ -378,9 +640,15 @@ class ENVClass
|
|
378
640
|
# e = ENV.reject
|
379
641
|
# e.each { |name, value| name.start_with?('b') } # => {"foo"=>"0"}
|
380
642
|
#
|
643
|
+
%a{annotate:rdoc:copy:ENV.reject}
|
381
644
|
def reject: () -> ::Enumerator[[ String, String ], self]
|
382
645
|
| () { (String name, String value) -> boolish } -> self
|
383
646
|
|
647
|
+
# <!--
|
648
|
+
# rdoc-file=hash.c
|
649
|
+
# - ENV.reject! { |name, value| block } -> ENV or nil
|
650
|
+
# - ENV.reject! -> an_enumerator
|
651
|
+
# -->
|
384
652
|
# Similar to ENV.delete_if, but returns `nil` if no changes were made.
|
385
653
|
#
|
386
654
|
# Yields each environment variable name and its value as a 2-element Array,
|
@@ -398,9 +666,17 @@ class ENVClass
|
|
398
666
|
# ENV # => {"foo"=>"0"}
|
399
667
|
# e.each { |name, value| name.start_with?('b') } # => nil
|
400
668
|
#
|
669
|
+
%a{annotate:rdoc:copy:ENV.reject!}
|
401
670
|
def reject!: () -> ::Enumerator[[ String, String ], self?]
|
402
671
|
| () { (String name, String value) -> boolish } -> self?
|
403
672
|
|
673
|
+
# <!--
|
674
|
+
# rdoc-file=hash.c
|
675
|
+
# - ENV.select { |name, value| block } -> hash of name/value pairs
|
676
|
+
# - ENV.select -> an_enumerator
|
677
|
+
# - ENV.filter { |name, value| block } -> hash of name/value pairs
|
678
|
+
# - ENV.filter -> an_enumerator
|
679
|
+
# -->
|
404
680
|
# ENV.filter is an alias for ENV.select.
|
405
681
|
#
|
406
682
|
# Yields each environment variable name and its value as a 2-element Array,
|
@@ -416,9 +692,17 @@ class ENVClass
|
|
416
692
|
# e = ENV.filter # => #<Enumerator: {"bar"=>"1", "baz"=>"2", "foo"=>"0"}:filter>
|
417
693
|
# e.each { |name, value | name.start_with?('b') } # => {"bar"=>"1", "baz"=>"2"}
|
418
694
|
#
|
695
|
+
%a{annotate:rdoc:copy:ENV.select}
|
419
696
|
def select: () -> ::Enumerator[[ String, String ], ::Hash[String, String]]
|
420
697
|
| () { (String name, String value) -> boolish } -> ::Hash[String, String]
|
421
698
|
|
699
|
+
# <!--
|
700
|
+
# rdoc-file=hash.c
|
701
|
+
# - ENV.select { |name, value| block } -> hash of name/value pairs
|
702
|
+
# - ENV.select -> an_enumerator
|
703
|
+
# - ENV.filter { |name, value| block } -> hash of name/value pairs
|
704
|
+
# - ENV.filter -> an_enumerator
|
705
|
+
# -->
|
422
706
|
# ENV.filter is an alias for ENV.select.
|
423
707
|
#
|
424
708
|
# Yields each environment variable name and its value as a 2-element Array,
|
@@ -434,8 +718,16 @@ class ENVClass
|
|
434
718
|
# e = ENV.filter # => #<Enumerator: {"bar"=>"1", "baz"=>"2", "foo"=>"0"}:filter>
|
435
719
|
# e.each { |name, value | name.start_with?('b') } # => {"bar"=>"1", "baz"=>"2"}
|
436
720
|
#
|
721
|
+
%a{annotate:rdoc:copy:ENV.filter}
|
437
722
|
alias filter select
|
438
723
|
|
724
|
+
# <!--
|
725
|
+
# rdoc-file=hash.c
|
726
|
+
# - ENV.select! { |name, value| block } -> ENV or nil
|
727
|
+
# - ENV.select! -> an_enumerator
|
728
|
+
# - ENV.filter! { |name, value| block } -> ENV or nil
|
729
|
+
# - ENV.filter! -> an_enumerator
|
730
|
+
# -->
|
439
731
|
# ENV.filter! is an alias for ENV.select!.
|
440
732
|
#
|
441
733
|
# Yields each environment variable name and its value as a 2-element Array,
|
@@ -466,9 +758,17 @@ class ENVClass
|
|
466
758
|
# ENV # => {"bar"=>"1", "baz"=>"2"}
|
467
759
|
# e.each { |name, value| true } # => nil
|
468
760
|
#
|
761
|
+
%a{annotate:rdoc:copy:ENV.select!}
|
469
762
|
def select!: () -> ::Enumerator[[ String, String ], self?]
|
470
763
|
| () { (String name, String value) -> boolish } -> self?
|
471
764
|
|
765
|
+
# <!--
|
766
|
+
# rdoc-file=hash.c
|
767
|
+
# - ENV.select! { |name, value| block } -> ENV or nil
|
768
|
+
# - ENV.select! -> an_enumerator
|
769
|
+
# - ENV.filter! { |name, value| block } -> ENV or nil
|
770
|
+
# - ENV.filter! -> an_enumerator
|
771
|
+
# -->
|
472
772
|
# ENV.filter! is an alias for ENV.select!.
|
473
773
|
#
|
474
774
|
# Yields each environment variable name and its value as a 2-element Array,
|
@@ -499,8 +799,13 @@ class ENVClass
|
|
499
799
|
# ENV # => {"bar"=>"1", "baz"=>"2"}
|
500
800
|
# e.each { |name, value| true } # => nil
|
501
801
|
#
|
802
|
+
%a{annotate:rdoc:copy:ENV.filter!}
|
502
803
|
alias filter! select!
|
503
804
|
|
805
|
+
# <!--
|
806
|
+
# rdoc-file=hash.c
|
807
|
+
# - ENV.shift -> [name, value] or nil
|
808
|
+
# -->
|
504
809
|
# Removes the first environment variable from ENV and returns a 2-element Array
|
505
810
|
# containing its name and value:
|
506
811
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
@@ -513,8 +818,13 @@ class ENVClass
|
|
513
818
|
#
|
514
819
|
# Returns `nil` if the environment is empty.
|
515
820
|
#
|
821
|
+
%a{annotate:rdoc:copy:ENV.shift}
|
516
822
|
def shift: () -> [ String, String ]?
|
517
823
|
|
824
|
+
# <!--
|
825
|
+
# rdoc-file=hash.c
|
826
|
+
# - ENV.invert -> hash of value/name pairs
|
827
|
+
# -->
|
518
828
|
# Returns a Hash whose keys are the ENV values, and whose values are the
|
519
829
|
# corresponding ENV names:
|
520
830
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
@@ -528,8 +838,13 @@ class ENVClass
|
|
528
838
|
# the order of overwriting is also OS-dependent. See [About
|
529
839
|
# Ordering](#class-ENV-label-About+Ordering).
|
530
840
|
#
|
841
|
+
%a{annotate:rdoc:copy:ENV.invert}
|
531
842
|
def invert: () -> ::Hash[String, String]
|
532
843
|
|
844
|
+
# <!--
|
845
|
+
# rdoc-file=hash.c
|
846
|
+
# - ENV.replace(hash) -> ENV
|
847
|
+
# -->
|
533
848
|
# Replaces the entire content of the environment variables with the name/value
|
534
849
|
# pairs in the given `hash`; returns ENV.
|
535
850
|
#
|
@@ -543,8 +858,16 @@ class ENVClass
|
|
543
858
|
# ENV.replace('foo' => '0', 'bar' => 1) # Raises TypeError (no implicit conversion of Integer into String)
|
544
859
|
# ENV.to_hash # => {"bar"=>"1", "foo"=>"0"}
|
545
860
|
#
|
861
|
+
%a{annotate:rdoc:copy:ENV.replace}
|
546
862
|
def replace: (Hash[String, String]) -> self
|
547
863
|
|
864
|
+
# <!--
|
865
|
+
# rdoc-file=hash.c
|
866
|
+
# - ENV.update(hash) -> ENV
|
867
|
+
# - ENV.update(hash) { |name, env_val, hash_val| block } -> ENV
|
868
|
+
# - ENV.merge!(hash) -> ENV
|
869
|
+
# - ENV.merge!(hash) { |name, env_val, hash_val| block } -> ENV
|
870
|
+
# -->
|
548
871
|
# ENV.update is an alias for ENV.merge!.
|
549
872
|
#
|
550
873
|
# Adds to ENV each key/value pair in the given `hash`; returns ENV:
|
@@ -577,9 +900,17 @@ class ENVClass
|
|
577
900
|
# Note that for the exceptions above, hash pairs preceding an invalid name or
|
578
901
|
# value are processed normally; those following are ignored.
|
579
902
|
#
|
903
|
+
%a{annotate:rdoc:copy:ENV.update}
|
580
904
|
def update: (Hash[String, String?]) -> self
|
581
905
|
| (Hash[String, String?]) { (String name, String env_val, String? hash_val) -> String } -> self
|
582
906
|
|
907
|
+
# <!--
|
908
|
+
# rdoc-file=hash.c
|
909
|
+
# - ENV.update(hash) -> ENV
|
910
|
+
# - ENV.update(hash) { |name, env_val, hash_val| block } -> ENV
|
911
|
+
# - ENV.merge!(hash) -> ENV
|
912
|
+
# - ENV.merge!(hash) { |name, env_val, hash_val| block } -> ENV
|
913
|
+
# -->
|
583
914
|
# ENV.update is an alias for ENV.merge!.
|
584
915
|
#
|
585
916
|
# Adds to ENV each key/value pair in the given `hash`; returns ENV:
|
@@ -612,26 +943,46 @@ class ENVClass
|
|
612
943
|
# Note that for the exceptions above, hash pairs preceding an invalid name or
|
613
944
|
# value are processed normally; those following are ignored.
|
614
945
|
#
|
946
|
+
%a{annotate:rdoc:copy:ENV.merge!}
|
615
947
|
alias merge! update
|
616
948
|
|
949
|
+
# <!--
|
950
|
+
# rdoc-file=hash.c
|
951
|
+
# - ENV.rehash -> nil
|
952
|
+
# -->
|
617
953
|
# (Provided for compatibility with Hash.)
|
618
954
|
#
|
619
955
|
# Does not modify ENV; returns `nil`.
|
620
956
|
#
|
957
|
+
%a{annotate:rdoc:copy:ENV.rehash}
|
621
958
|
def rehash: () -> nil
|
622
959
|
|
960
|
+
# <!--
|
961
|
+
# rdoc-file=hash.c
|
962
|
+
# - ENV.to_a -> array of 2-element arrays
|
963
|
+
# -->
|
623
964
|
# Returns the contents of ENV as an Array of 2-element Arrays, each of which is
|
624
965
|
# a name/value pair:
|
625
966
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
626
967
|
# ENV.to_a # => [["bar", "1"], ["foo", "0"]]
|
627
968
|
#
|
969
|
+
%a{annotate:rdoc:copy:ENV.to_a}
|
628
970
|
def to_a: () -> ::Array[[ String, String ]]
|
629
971
|
|
972
|
+
# <!--
|
973
|
+
# rdoc-file=hash.c
|
974
|
+
# - ENV.to_s -> "ENV"
|
975
|
+
# -->
|
630
976
|
# Returns String 'ENV':
|
631
977
|
# ENV.to_s # => "ENV"
|
632
978
|
#
|
979
|
+
%a{annotate:rdoc:copy:ENV.to_s}
|
633
980
|
def to_s: () -> "ENV"
|
634
981
|
|
982
|
+
# <!--
|
983
|
+
# rdoc-file=hash.c
|
984
|
+
# - ENV.key(value) -> name or nil
|
985
|
+
# -->
|
635
986
|
# Returns the name of the first environment variable with `value`, if it exists:
|
636
987
|
# ENV.replace('foo' => '0', 'bar' => '0')
|
637
988
|
# ENV.key('0') # => "foo"
|
@@ -646,30 +997,52 @@ class ENVClass
|
|
646
997
|
#
|
647
998
|
# See [Invalid Names and Values](#class-ENV-label-Invalid+Names+and+Values).
|
648
999
|
#
|
1000
|
+
%a{annotate:rdoc:copy:ENV.key}
|
649
1001
|
def key: (String value) -> String?
|
650
1002
|
|
1003
|
+
# <!--
|
1004
|
+
# rdoc-file=hash.c
|
1005
|
+
# - ENV.length -> an_integer
|
1006
|
+
# - ENV.size -> an_integer
|
1007
|
+
# -->
|
651
1008
|
# Returns the count of environment variables:
|
652
1009
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
653
1010
|
# ENV.length # => 2
|
654
1011
|
# ENV.size # => 2
|
655
1012
|
#
|
1013
|
+
%a{annotate:rdoc:copy:ENV.size}
|
656
1014
|
def size: () -> Integer
|
657
1015
|
|
1016
|
+
# <!--
|
1017
|
+
# rdoc-file=hash.c
|
1018
|
+
# - ENV.length -> an_integer
|
1019
|
+
# - ENV.size -> an_integer
|
1020
|
+
# -->
|
658
1021
|
# Returns the count of environment variables:
|
659
1022
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
660
1023
|
# ENV.length # => 2
|
661
1024
|
# ENV.size # => 2
|
662
1025
|
#
|
1026
|
+
%a{annotate:rdoc:copy:ENV.length}
|
663
1027
|
alias length size
|
664
1028
|
|
1029
|
+
# <!--
|
1030
|
+
# rdoc-file=hash.c
|
1031
|
+
# - ENV.empty? -> true or false
|
1032
|
+
# -->
|
665
1033
|
# Returns `true` when there are no environment variables, `false` otherwise:
|
666
1034
|
# ENV.clear
|
667
1035
|
# ENV.empty? # => true
|
668
1036
|
# ENV['foo'] = '0'
|
669
1037
|
# ENV.empty? # => false
|
670
1038
|
#
|
1039
|
+
%a{annotate:rdoc:copy:ENV.empty?}
|
671
1040
|
def empty?: () -> bool
|
672
1041
|
|
1042
|
+
# <!--
|
1043
|
+
# rdoc-file=hash.c
|
1044
|
+
# - ENV.keys -> array of names
|
1045
|
+
# -->
|
673
1046
|
# Returns all variable names in an Array:
|
674
1047
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
675
1048
|
# ENV.keys # => ['bar', 'foo']
|
@@ -679,8 +1052,13 @@ class ENVClass
|
|
679
1052
|
#
|
680
1053
|
# Returns the empty Array if ENV is empty.
|
681
1054
|
#
|
1055
|
+
%a{annotate:rdoc:copy:ENV.keys}
|
682
1056
|
def keys: () -> ::Array[String]
|
683
1057
|
|
1058
|
+
# <!--
|
1059
|
+
# rdoc-file=hash.c
|
1060
|
+
# - ENV.values -> array of values
|
1061
|
+
# -->
|
684
1062
|
# Returns all environment variable values in an Array:
|
685
1063
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
686
1064
|
# ENV.values # => ['1', '0']
|
@@ -690,8 +1068,13 @@ class ENVClass
|
|
690
1068
|
#
|
691
1069
|
# Returns the empty Array if ENV is empty.
|
692
1070
|
#
|
1071
|
+
%a{annotate:rdoc:copy:ENV.values}
|
693
1072
|
def values: () -> ::Array[String]
|
694
1073
|
|
1074
|
+
# <!--
|
1075
|
+
# rdoc-file=hash.c
|
1076
|
+
# - ENV.values_at(*names) -> array of values
|
1077
|
+
# -->
|
695
1078
|
# Returns an Array containing the environment variable values associated with
|
696
1079
|
# the given names:
|
697
1080
|
# ENV.replace('foo' => '0', 'bar' => '1', 'baz' => '2')
|
@@ -705,8 +1088,16 @@ class ENVClass
|
|
705
1088
|
# Raises an exception if any name is invalid. See [Invalid Names and
|
706
1089
|
# Values](#class-ENV-label-Invalid+Names+and+Values).
|
707
1090
|
#
|
1091
|
+
%a{annotate:rdoc:copy:ENV.values_at}
|
708
1092
|
def values_at: (*String names) -> ::Array[String?]
|
709
1093
|
|
1094
|
+
# <!--
|
1095
|
+
# rdoc-file=hash.c
|
1096
|
+
# - ENV.include?(name) -> true or false
|
1097
|
+
# - ENV.has_key?(name) -> true or false
|
1098
|
+
# - ENV.member?(name) -> true or false
|
1099
|
+
# - ENV.key?(name) -> true or false
|
1100
|
+
# -->
|
710
1101
|
# ENV.has_key?, ENV.member?, and ENV.key? are aliases for ENV.include?.
|
711
1102
|
#
|
712
1103
|
# Returns `true` if there is an environment variable with the given `name`:
|
@@ -732,8 +1123,16 @@ class ENVClass
|
|
732
1123
|
# Raises an exception if `name` is not a String:
|
733
1124
|
# ENV.include?(Object.new) # TypeError (no implicit conversion of Object into String)
|
734
1125
|
#
|
1126
|
+
%a{annotate:rdoc:copy:ENV.include?}
|
735
1127
|
def include?: (String name) -> bool
|
736
1128
|
|
1129
|
+
# <!--
|
1130
|
+
# rdoc-file=hash.c
|
1131
|
+
# - ENV.include?(name) -> true or false
|
1132
|
+
# - ENV.has_key?(name) -> true or false
|
1133
|
+
# - ENV.member?(name) -> true or false
|
1134
|
+
# - ENV.key?(name) -> true or false
|
1135
|
+
# -->
|
737
1136
|
# ENV.has_key?, ENV.member?, and ENV.key? are aliases for ENV.include?.
|
738
1137
|
#
|
739
1138
|
# Returns `true` if there is an environment variable with the given `name`:
|
@@ -759,8 +1158,16 @@ class ENVClass
|
|
759
1158
|
# Raises an exception if `name` is not a String:
|
760
1159
|
# ENV.include?(Object.new) # TypeError (no implicit conversion of Object into String)
|
761
1160
|
#
|
1161
|
+
%a{annotate:rdoc:copy:ENV.member?}
|
762
1162
|
alias member? include?
|
763
1163
|
|
1164
|
+
# <!--
|
1165
|
+
# rdoc-file=hash.c
|
1166
|
+
# - ENV.include?(name) -> true or false
|
1167
|
+
# - ENV.has_key?(name) -> true or false
|
1168
|
+
# - ENV.member?(name) -> true or false
|
1169
|
+
# - ENV.key?(name) -> true or false
|
1170
|
+
# -->
|
764
1171
|
# ENV.has_key?, ENV.member?, and ENV.key? are aliases for ENV.include?.
|
765
1172
|
#
|
766
1173
|
# Returns `true` if there is an environment variable with the given `name`:
|
@@ -786,8 +1193,14 @@ class ENVClass
|
|
786
1193
|
# Raises an exception if `name` is not a String:
|
787
1194
|
# ENV.include?(Object.new) # TypeError (no implicit conversion of Object into String)
|
788
1195
|
#
|
1196
|
+
%a{annotate:rdoc:copy:ENV.has_key?}
|
789
1197
|
alias has_key? include?
|
790
1198
|
|
1199
|
+
# <!--
|
1200
|
+
# rdoc-file=hash.c
|
1201
|
+
# - ENV.value?(value) -> true or false
|
1202
|
+
# - ENV.has_value?(value) -> true or false
|
1203
|
+
# -->
|
791
1204
|
# Returns `true` if `value` is the value for some environment variable name,
|
792
1205
|
# `false` otherwise:
|
793
1206
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
@@ -796,8 +1209,14 @@ class ENVClass
|
|
796
1209
|
# ENV.value?('2') # => false
|
797
1210
|
# ENV.has_value?('2') # => false
|
798
1211
|
#
|
1212
|
+
%a{annotate:rdoc:copy:ENV.has_value?}
|
799
1213
|
def has_value?: (String value) -> bool
|
800
1214
|
|
1215
|
+
# <!--
|
1216
|
+
# rdoc-file=hash.c
|
1217
|
+
# - ENV.value?(value) -> true or false
|
1218
|
+
# - ENV.has_value?(value) -> true or false
|
1219
|
+
# -->
|
801
1220
|
# Returns `true` if `value` is the value for some environment variable name,
|
802
1221
|
# `false` otherwise:
|
803
1222
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
@@ -806,8 +1225,16 @@ class ENVClass
|
|
806
1225
|
# ENV.value?('2') # => false
|
807
1226
|
# ENV.has_value?('2') # => false
|
808
1227
|
#
|
1228
|
+
%a{annotate:rdoc:copy:ENV.value?}
|
809
1229
|
alias value? has_value?
|
810
1230
|
|
1231
|
+
# <!--
|
1232
|
+
# rdoc-file=hash.c
|
1233
|
+
# - ENV.include?(name) -> true or false
|
1234
|
+
# - ENV.has_key?(name) -> true or false
|
1235
|
+
# - ENV.member?(name) -> true or false
|
1236
|
+
# - ENV.key?(name) -> true or false
|
1237
|
+
# -->
|
811
1238
|
# ENV.has_key?, ENV.member?, and ENV.key? are aliases for ENV.include?.
|
812
1239
|
#
|
813
1240
|
# Returns `true` if there is an environment variable with the given `name`:
|
@@ -833,14 +1260,24 @@ class ENVClass
|
|
833
1260
|
# Raises an exception if `name` is not a String:
|
834
1261
|
# ENV.include?(Object.new) # TypeError (no implicit conversion of Object into String)
|
835
1262
|
#
|
1263
|
+
%a{annotate:rdoc:copy:ENV.key?}
|
836
1264
|
alias key? include?
|
837
1265
|
|
1266
|
+
# <!--
|
1267
|
+
# rdoc-file=hash.c
|
1268
|
+
# - ENV.to_hash -> hash of name/value pairs
|
1269
|
+
# -->
|
838
1270
|
# Returns a Hash containing all name/value pairs from ENV:
|
839
1271
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
840
1272
|
# ENV.to_hash # => {"bar"=>"1", "foo"=>"0"}
|
841
1273
|
#
|
1274
|
+
%a{annotate:rdoc:copy:ENV.to_hash}
|
842
1275
|
def to_hash: () -> ::Hash[String, String]
|
843
1276
|
|
1277
|
+
# <!--
|
1278
|
+
# rdoc-file=hash.c
|
1279
|
+
# - ENV.assoc(name) -> [name, value] or nil
|
1280
|
+
# -->
|
844
1281
|
# Returns a 2-element Array containing the name and value of the environment
|
845
1282
|
# variable for `name` if it exists:
|
846
1283
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
@@ -862,8 +1299,13 @@ class ENVClass
|
|
862
1299
|
# Raises an exception if `name` is not a String:
|
863
1300
|
# ENV.assoc(Object.new) # TypeError (no implicit conversion of Object into String)
|
864
1301
|
#
|
1302
|
+
%a{annotate:rdoc:copy:ENV.assoc}
|
865
1303
|
def assoc: (String name) -> [ String, String ]?
|
866
1304
|
|
1305
|
+
# <!--
|
1306
|
+
# rdoc-file=hash.c
|
1307
|
+
# - ENV.rassoc(value) -> [name, value] or nil
|
1308
|
+
# -->
|
867
1309
|
# Returns a 2-element Array containing the name and value of the **first**
|
868
1310
|
# **found** environment variable that has value `value`, if one exists:
|
869
1311
|
# ENV.replace('foo' => '0', 'bar' => '0')
|
@@ -874,8 +1316,13 @@ class ENVClass
|
|
874
1316
|
#
|
875
1317
|
# Returns `nil` if there is no such environment variable.
|
876
1318
|
#
|
1319
|
+
%a{annotate:rdoc:copy:ENV.rassoc}
|
877
1320
|
def rassoc: (String value) -> [ String, String ]?
|
878
1321
|
end
|
879
1322
|
|
880
|
-
#
|
1323
|
+
# <!-- rdoc-file=hash.c -->
|
1324
|
+
# ENV is a Hash-like accessor for environment variables.
|
1325
|
+
#
|
1326
|
+
# See ENV (the class) for more details.
|
1327
|
+
#
|
881
1328
|
ENV: ENVClass
|