rbs 3.0.0.dev.2 → 3.0.0.dev.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +2 -1
- data/.github/workflows/ruby.yml +4 -0
- data/Gemfile.lock +11 -11
- data/Rakefile +2 -2
- data/Steepfile +1 -1
- data/core/array.rbs +573 -423
- data/core/basic_object.rbs +11 -39
- data/core/binding.rbs +1 -1
- data/core/builtin.rbs +8 -0
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +7 -18
- data/core/complex.rbs +2 -2
- data/core/data.rbs +419 -0
- data/core/dir.rbs +52 -104
- data/core/encoding.rbs +22 -181
- data/core/enumerable.rbs +212 -175
- data/core/enumerator/product.rbs +96 -0
- data/core/enumerator.rbs +57 -8
- data/core/errors.rbs +8 -2
- data/core/exception.rbs +41 -0
- data/core/fiber.rbs +95 -12
- data/core/file.rbs +840 -275
- data/core/file_test.rbs +34 -19
- data/core/float.rbs +40 -96
- data/core/gc.rbs +15 -3
- data/core/hash.rbs +113 -175
- data/core/integer.rbs +85 -145
- data/core/io/buffer.rbs +187 -60
- data/core/io/wait.rbs +28 -16
- data/core/io.rbs +1859 -1389
- data/core/kernel.rbs +525 -961
- data/core/match_data.rbs +306 -142
- data/core/math.rbs +506 -234
- data/core/method.rbs +0 -24
- data/core/module.rbs +110 -17
- data/core/nil_class.rbs +2 -0
- data/core/numeric.rbs +76 -144
- data/core/object.rbs +88 -212
- data/core/proc.rbs +17 -5
- data/core/process.rbs +22 -5
- data/core/ractor.rbs +1 -1
- data/core/random.rbs +20 -3
- data/core/range.rbs +91 -89
- data/core/rational.rbs +2 -3
- data/core/rbs/unnamed/argf.rbs +177 -120
- data/core/rbs/unnamed/env_class.rbs +89 -163
- data/core/rbs/unnamed/random.rbs +36 -12
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +462 -272
- data/core/ruby_vm.rbs +210 -0
- data/{stdlib/set/0 → core}/set.rbs +43 -47
- data/core/string.rbs +1403 -1332
- data/core/string_io.rbs +191 -107
- data/core/struct.rbs +67 -63
- data/core/symbol.rbs +187 -201
- data/core/thread.rbs +40 -35
- data/core/time.rbs +902 -826
- data/core/trace_point.rbs +55 -6
- data/core/unbound_method.rbs +48 -24
- data/docs/collection.md +4 -0
- data/docs/syntax.md +55 -0
- data/ext/rbs_extension/parser.c +5 -6
- data/lib/rbs/cli.rb +6 -1
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +3 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -2
- data/lib/rbs/collection/sources/local.rb +79 -0
- data/lib/rbs/collection/sources.rb +8 -1
- data/lib/rbs/environment.rb +6 -5
- data/lib/rbs/environment_loader.rb +3 -2
- data/lib/rbs/errors.rb +18 -0
- data/lib/rbs/locator.rb +26 -7
- data/lib/rbs/sorter.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/collection/sources.rbs +32 -3
- data/sig/environment.rbs +2 -3
- data/sig/locator.rbs +14 -2
- data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
- data/stdlib/cgi/0/core.rbs +16 -0
- data/stdlib/coverage/0/coverage.rbs +50 -8
- data/stdlib/csv/0/csv.rbs +1 -1
- data/stdlib/date/0/date.rbs +856 -726
- data/stdlib/date/0/date_time.rbs +83 -210
- data/stdlib/erb/0/erb.rbs +13 -36
- data/stdlib/etc/0/etc.rbs +127 -20
- data/stdlib/fileutils/0/fileutils.rbs +1290 -381
- data/stdlib/logger/0/logger.rbs +466 -316
- data/stdlib/net-http/0/net-http.rbs +2211 -534
- data/stdlib/nkf/0/nkf.rbs +5 -5
- data/stdlib/objspace/0/objspace.rbs +31 -14
- data/stdlib/openssl/0/openssl.rbs +11 -7
- data/stdlib/optparse/0/optparse.rbs +20 -17
- data/stdlib/pathname/0/pathname.rbs +21 -4
- data/stdlib/pstore/0/pstore.rbs +378 -154
- data/stdlib/pty/0/pty.rbs +24 -8
- data/stdlib/ripper/0/ripper.rbs +1650 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -15
- data/stdlib/socket/0/socket.rbs +36 -3
- data/stdlib/strscan/0/string_scanner.rbs +7 -5
- data/stdlib/tempfile/0/tempfile.rbs +104 -44
- data/stdlib/time/0/time.rbs +2 -2
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/yaml/0/yaml.rbs +2 -2
- data/stdlib/zlib/0/zlib.rbs +1 -1
- metadata +8 -6
- data/core/deprecated.rbs +0 -9
- data/sig/shims/ripper.rbs +0 -8
@@ -93,168 +93,90 @@ module RBS
|
|
93
93
|
#
|
94
94
|
# First, what's elsewhere. Class ENV:
|
95
95
|
#
|
96
|
-
# * Inherits from [class
|
97
|
-
#
|
98
|
-
# * Extends [module
|
99
|
-
# Enumerable](Enumerable.html#module-Enumerable-label-What-27s+Here),
|
96
|
+
# * Inherits from [class Object](rdoc-ref:Object@What-27s+Here).
|
97
|
+
# * Extends [module Enumerable](rdoc-ref:Enumerable@What-27s+Here),
|
100
98
|
#
|
101
99
|
#
|
102
100
|
# Here, class ENV provides methods that are useful for:
|
103
101
|
#
|
104
|
-
# * [Querying](
|
105
|
-
# * [Assigning](
|
106
|
-
# * [Deleting](
|
107
|
-
# * [Iterating](
|
108
|
-
# * [Converting](
|
109
|
-
# * [And more ....](
|
102
|
+
# * [Querying](rdoc-ref:ENV@Methods+for+Querying)
|
103
|
+
# * [Assigning](rdoc-ref:ENV@Methods+for+Assigning)
|
104
|
+
# * [Deleting](rdoc-ref:ENV@Methods+for+Deleting)
|
105
|
+
# * [Iterating](rdoc-ref:ENV@Methods+for+Iterating)
|
106
|
+
# * [Converting](rdoc-ref:ENV@Methods+for+Converting)
|
107
|
+
# * [And more ....](rdoc-ref:ENV@More+Methods)
|
110
108
|
#
|
111
109
|
#
|
112
110
|
# ### Methods for Querying
|
113
111
|
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
#
|
120
|
-
#
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
# ::include?, ::has_key?, ::key?, ::member?
|
125
|
-
# : Returns whether the given name is in ENV.
|
126
|
-
#
|
127
|
-
# ::key
|
128
|
-
# : Returns the name of the first entry with the given value.
|
129
|
-
#
|
130
|
-
# ::size, ::length
|
131
|
-
# : Returns the number of entries.
|
132
|
-
#
|
133
|
-
# ::value?
|
134
|
-
# : Returns whether any entry has the given value.
|
135
|
-
#
|
112
|
+
# * ::[]: Returns the value for the given environment variable name if it
|
113
|
+
# exists:
|
114
|
+
# * ::empty?: Returns whether ENV is empty.
|
115
|
+
# * ::has_value?, ::value?: Returns whether the given value is in ENV.
|
116
|
+
# * ::include?, ::has_key?, ::key?, ::member?: Returns whether the given name
|
117
|
+
# is in ENV.
|
118
|
+
# * ::key: Returns the name of the first entry with the given value.
|
119
|
+
# * ::size, ::length: Returns the number of entries.
|
120
|
+
# * ::value?: Returns whether any entry has the given value.
|
136
121
|
#
|
137
122
|
#
|
138
123
|
# ### Methods for Assigning
|
139
124
|
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
# :
|
145
|
-
#
|
146
|
-
# ::update, ::merge!
|
147
|
-
# : Adds to ENV each key/value pair in the given hash.
|
148
|
-
#
|
149
|
-
# ::replace
|
150
|
-
# : Replaces the entire content of the ENV with the name/value pairs in
|
151
|
-
# the given hash.
|
152
|
-
#
|
125
|
+
# * ::[]=, ::store: Creates, updates, or deletes the named environment
|
126
|
+
# variable.
|
127
|
+
# * ::clear: Removes every environment variable; returns ENV:
|
128
|
+
# * ::update, ::merge!: Adds to ENV each key/value pair in the given hash.
|
129
|
+
# * ::replace: Replaces the entire content of the ENV with the name/value
|
130
|
+
# pairs in the given hash.
|
153
131
|
#
|
154
132
|
#
|
155
133
|
# ### Methods for Deleting
|
156
134
|
#
|
157
|
-
#
|
158
|
-
# :
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
#
|
163
|
-
# ::keep_if
|
164
|
-
# : Deletes entries not selected by the block.
|
165
|
-
#
|
166
|
-
# ::reject!
|
167
|
-
# : Similar to #delete_if, but returns `nil` if no change was made.
|
168
|
-
#
|
169
|
-
# ::select!, ::filter!
|
170
|
-
# : Deletes entries selected by the block.
|
171
|
-
#
|
172
|
-
# ::shift
|
173
|
-
# : Removes and returns the first entry.
|
174
|
-
#
|
135
|
+
# * ::delete: Deletes the named environment variable name if it exists.
|
136
|
+
# * ::delete_if: Deletes entries selected by the block.
|
137
|
+
# * ::keep_if: Deletes entries not selected by the block.
|
138
|
+
# * ::reject!: Similar to #delete_if, but returns `nil` if no change was made.
|
139
|
+
# * ::select!, ::filter!: Deletes entries selected by the block.
|
140
|
+
# * ::shift: Removes and returns the first entry.
|
175
141
|
#
|
176
142
|
#
|
177
143
|
# ### Methods for Iterating
|
178
144
|
#
|
179
|
-
#
|
180
|
-
# :
|
181
|
-
#
|
182
|
-
# ::each_key
|
183
|
-
# : Calls the block with each name.
|
184
|
-
#
|
185
|
-
# ::each_value
|
186
|
-
# : Calls the block with each value.
|
187
|
-
#
|
145
|
+
# * ::each, ::each_pair: Calls the block with each name/value pair.
|
146
|
+
# * ::each_key: Calls the block with each name.
|
147
|
+
# * ::each_value: Calls the block with each value.
|
188
148
|
#
|
189
149
|
#
|
190
150
|
# ### Methods for Converting
|
191
151
|
#
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
# :
|
198
|
-
#
|
199
|
-
#
|
200
|
-
# :
|
201
|
-
#
|
202
|
-
#
|
203
|
-
# :
|
204
|
-
#
|
205
|
-
#
|
206
|
-
# :
|
207
|
-
#
|
208
|
-
#
|
209
|
-
# :
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
# : Returns an array of all names.
|
214
|
-
#
|
215
|
-
# ::rassoc
|
216
|
-
# : Returns the name and value of the first found entry that has the given
|
217
|
-
# value.
|
218
|
-
#
|
219
|
-
# ::reject
|
220
|
-
# : Returns a hash of those entries not rejected by the block.
|
221
|
-
#
|
222
|
-
# ::select, ::filter
|
223
|
-
# : Returns a hash of name/value pairs selected by the block.
|
224
|
-
#
|
225
|
-
# ::slice
|
226
|
-
# : Returns a hash of the given names and their corresponding values.
|
227
|
-
#
|
228
|
-
# ::to_a
|
229
|
-
# : Returns the entries as an array of 2-element Arrays.
|
230
|
-
#
|
231
|
-
# ::to_h
|
232
|
-
# : Returns a hash of entries selected by the block.
|
233
|
-
#
|
234
|
-
# ::to_hash
|
235
|
-
# : Returns a hash of all entries.
|
236
|
-
#
|
237
|
-
# ::to_s
|
238
|
-
# : Returns the string `'ENV'`.
|
239
|
-
#
|
240
|
-
# ::values
|
241
|
-
# : Returns all values as an array.
|
242
|
-
#
|
243
|
-
# ::values_at
|
244
|
-
# : Returns an array of the values for the given name.
|
245
|
-
#
|
152
|
+
# * ::assoc: Returns a 2-element array containing the name and value of the
|
153
|
+
# named environment variable if it exists:
|
154
|
+
# * ::clone: Returns ENV (and issues a warning).
|
155
|
+
# * ::except: Returns a hash of all name/value pairs except those given.
|
156
|
+
# * ::fetch: Returns the value for the given name.
|
157
|
+
# * ::inspect: Returns the contents of ENV as a string.
|
158
|
+
# * ::invert: Returns a hash whose keys are the ENV values, and whose values
|
159
|
+
# are the corresponding ENV names.
|
160
|
+
# * ::keys: Returns an array of all names.
|
161
|
+
# * ::rassoc: Returns the name and value of the first found entry that has the
|
162
|
+
# given value.
|
163
|
+
# * ::reject: Returns a hash of those entries not rejected by the block.
|
164
|
+
# * ::select, ::filter: Returns a hash of name/value pairs selected by the
|
165
|
+
# block.
|
166
|
+
# * ::slice: Returns a hash of the given names and their corresponding values.
|
167
|
+
# * ::to_a: Returns the entries as an array of 2-element Arrays.
|
168
|
+
# * ::to_h: Returns a hash of entries selected by the block.
|
169
|
+
# * ::to_hash: Returns a hash of all entries.
|
170
|
+
# * ::to_s: Returns the string `'ENV'`.
|
171
|
+
# * ::values: Returns all values as an array.
|
172
|
+
# * ::values_at: Returns an array of the values for the given name.
|
246
173
|
#
|
247
174
|
#
|
248
175
|
# ### More Methods
|
249
176
|
#
|
250
|
-
#
|
251
|
-
# :
|
252
|
-
#
|
253
|
-
# ::freeze
|
254
|
-
# : Raises an exception.
|
255
|
-
#
|
256
|
-
# ::rehash
|
257
|
-
# : Returns `nil`, without modifying ENV.
|
177
|
+
# * ::dup: Raises an exception.
|
178
|
+
# * ::freeze: Raises an exception.
|
179
|
+
# * ::rehash: Returns `nil`, without modifying ENV.
|
258
180
|
#
|
259
181
|
%a{annotate:rdoc:copy:ENV}
|
260
182
|
class ENVClass
|
@@ -271,7 +193,7 @@ module RBS
|
|
271
193
|
# Returns `nil` if the named variable does not exist.
|
272
194
|
#
|
273
195
|
# Raises an exception if `name` is invalid. See [Invalid Names and
|
274
|
-
# Values](
|
196
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
275
197
|
#
|
276
198
|
%a{annotate:rdoc:copy:ENV.[]}
|
277
199
|
def []: (String name) -> String?
|
@@ -305,7 +227,7 @@ module RBS
|
|
305
227
|
# ENV.fetch('foo') # Raises KeyError (key not found: "foo")
|
306
228
|
#
|
307
229
|
# Raises an exception if `name` is invalid. See [Invalid Names and
|
308
|
-
# Values](
|
230
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
309
231
|
#
|
310
232
|
%a{annotate:rdoc:copy:ENV.fetch}
|
311
233
|
def fetch: (String name) -> String
|
@@ -321,7 +243,7 @@ module RBS
|
|
321
243
|
#
|
322
244
|
# Creates, updates, or deletes the named environment variable, returning the
|
323
245
|
# value. Both `name` and `value` may be instances of String. See [Valid Names
|
324
|
-
# and Values](
|
246
|
+
# and Values](rdoc-ref:ENV@Valid+Names+and+Values).
|
325
247
|
#
|
326
248
|
# * If the named environment variable does not exist:
|
327
249
|
# * If `value` is `nil`, does nothing.
|
@@ -362,7 +284,7 @@ module RBS
|
|
362
284
|
#
|
363
285
|
#
|
364
286
|
# Raises an exception if `name` or `value` is invalid. See [Invalid Names and
|
365
|
-
# Values](
|
287
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
366
288
|
#
|
367
289
|
%a{annotate:rdoc:copy:ENV.[]=}
|
368
290
|
def []=: (String name, String? value) -> String?
|
@@ -376,7 +298,7 @@ module RBS
|
|
376
298
|
#
|
377
299
|
# Creates, updates, or deletes the named environment variable, returning the
|
378
300
|
# value. Both `name` and `value` may be instances of String. See [Valid Names
|
379
|
-
# and Values](
|
301
|
+
# and Values](rdoc-ref:ENV@Valid+Names+and+Values).
|
380
302
|
#
|
381
303
|
# * If the named environment variable does not exist:
|
382
304
|
# * If `value` is `nil`, does nothing.
|
@@ -417,7 +339,7 @@ module RBS
|
|
417
339
|
#
|
418
340
|
#
|
419
341
|
# Raises an exception if `name` or `value` is invalid. See [Invalid Names and
|
420
|
-
# Values](
|
342
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
421
343
|
#
|
422
344
|
%a{annotate:rdoc:copy:ENV.store}
|
423
345
|
alias store []=
|
@@ -533,7 +455,7 @@ module RBS
|
|
533
455
|
# ENV.delete('foo') { |name| raise 'ignored' } # => "0"
|
534
456
|
#
|
535
457
|
# Raises an exception if `name` is invalid. See [Invalid Names and
|
536
|
-
# Values](
|
458
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
537
459
|
#
|
538
460
|
%a{annotate:rdoc:copy:ENV.delete}
|
539
461
|
def delete: (String name) -> String?
|
@@ -595,7 +517,7 @@ module RBS
|
|
595
517
|
# ENV.slice('baz', 'foo') # => {"baz"=>"2", "foo"=>"0"}
|
596
518
|
#
|
597
519
|
# Raises an exception if any of the `names` is invalid (see [Invalid Names and
|
598
|
-
# Values](
|
520
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values)):
|
599
521
|
# ENV.slice('foo', 'bar', :bat) # Raises TypeError (no implicit conversion of Symbol into String)
|
600
522
|
#
|
601
523
|
%a{annotate:rdoc:copy:ENV.slice}
|
@@ -816,7 +738,7 @@ module RBS
|
|
816
738
|
# ENV.to_hash # => {'foo' => '0'}
|
817
739
|
#
|
818
740
|
# Exactly which environment variable is "first" is OS-dependent. See [About
|
819
|
-
# Ordering](
|
741
|
+
# Ordering](rdoc-ref:ENV@About+Ordering).
|
820
742
|
#
|
821
743
|
# Returns `nil` if the environment is empty.
|
822
744
|
#
|
@@ -838,7 +760,7 @@ module RBS
|
|
838
760
|
#
|
839
761
|
# Note that the order of the ENV processing is OS-dependent, which means that
|
840
762
|
# the order of overwriting is also OS-dependent. See [About
|
841
|
-
# Ordering](
|
763
|
+
# Ordering](rdoc-ref:ENV@About+Ordering).
|
842
764
|
#
|
843
765
|
%a{annotate:rdoc:copy:ENV.invert}
|
844
766
|
def invert: () -> ::Hash[String, String]
|
@@ -855,7 +777,7 @@ module RBS
|
|
855
777
|
# ENV.to_hash # => {"bar"=>"1", "foo"=>"0"}
|
856
778
|
#
|
857
779
|
# Raises an exception if a name or value is invalid (see [Invalid Names and
|
858
|
-
# Values](
|
780
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values)):
|
859
781
|
# ENV.replace('foo' => '0', :bar => '1') # Raises TypeError (no implicit conversion of Symbol into String)
|
860
782
|
# ENV.replace('foo' => '0', 'bar' => 1) # Raises TypeError (no implicit conversion of Integer into String)
|
861
783
|
# ENV.to_hash # => {"bar"=>"1", "foo"=>"0"}
|
@@ -865,10 +787,12 @@ module RBS
|
|
865
787
|
|
866
788
|
# <!--
|
867
789
|
# rdoc-file=hash.c
|
868
|
-
# - ENV.update
|
869
|
-
# - ENV.update(
|
870
|
-
# - ENV.
|
871
|
-
# - ENV.merge!
|
790
|
+
# - ENV.update -> ENV
|
791
|
+
# - ENV.update(*hashes) -> ENV
|
792
|
+
# - ENV.update(*hashes) { |name, env_val, hash_val| block } -> ENV
|
793
|
+
# - ENV.merge! -> ENV
|
794
|
+
# - ENV.merge!(*hashes) -> ENV
|
795
|
+
# - ENV.merge!(*hashes) { |name, env_val, hash_val| block } -> ENV
|
872
796
|
# -->
|
873
797
|
# ENV.update is an alias for ENV.merge!.
|
874
798
|
#
|
@@ -887,7 +811,7 @@ module RBS
|
|
887
811
|
# ENV.merge!('foo' => '5') { |name, env_val, hash_val | env_val + hash_val } # => {"bar"=>"1", "foo"=>"45"}
|
888
812
|
#
|
889
813
|
# Raises an exception if a name or value is invalid (see [Invalid Names and
|
890
|
-
# Values](
|
814
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values));
|
891
815
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
892
816
|
# ENV.merge!('foo' => '6', :bar => '7', 'baz' => '9') # Raises TypeError (no implicit conversion of Symbol into String)
|
893
817
|
# ENV # => {"bar"=>"1", "foo"=>"6"}
|
@@ -895,7 +819,7 @@ module RBS
|
|
895
819
|
# ENV # => {"bar"=>"1", "foo"=>"7"}
|
896
820
|
#
|
897
821
|
# Raises an exception if the block returns an invalid name: (see [Invalid Names
|
898
|
-
# and Values](
|
822
|
+
# and Values](rdoc-ref:ENV@Invalid+Names+and+Values)):
|
899
823
|
# ENV.merge!('bat' => '8', 'foo' => '9') { |name, env_val, hash_val | 10 } # Raises TypeError (no implicit conversion of Integer into String)
|
900
824
|
# ENV # => {"bar"=>"1", "bat"=>"8", "foo"=>"7"}
|
901
825
|
#
|
@@ -908,10 +832,12 @@ module RBS
|
|
908
832
|
|
909
833
|
# <!--
|
910
834
|
# rdoc-file=hash.c
|
911
|
-
# - ENV.update
|
912
|
-
# - ENV.update(
|
913
|
-
# - ENV.
|
914
|
-
# - ENV.merge!
|
835
|
+
# - ENV.update -> ENV
|
836
|
+
# - ENV.update(*hashes) -> ENV
|
837
|
+
# - ENV.update(*hashes) { |name, env_val, hash_val| block } -> ENV
|
838
|
+
# - ENV.merge! -> ENV
|
839
|
+
# - ENV.merge!(*hashes) -> ENV
|
840
|
+
# - ENV.merge!(*hashes) { |name, env_val, hash_val| block } -> ENV
|
915
841
|
# -->
|
916
842
|
# ENV.update is an alias for ENV.merge!.
|
917
843
|
#
|
@@ -930,7 +856,7 @@ module RBS
|
|
930
856
|
# ENV.merge!('foo' => '5') { |name, env_val, hash_val | env_val + hash_val } # => {"bar"=>"1", "foo"=>"45"}
|
931
857
|
#
|
932
858
|
# Raises an exception if a name or value is invalid (see [Invalid Names and
|
933
|
-
# Values](
|
859
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values));
|
934
860
|
# ENV.replace('foo' => '0', 'bar' => '1')
|
935
861
|
# ENV.merge!('foo' => '6', :bar => '7', 'baz' => '9') # Raises TypeError (no implicit conversion of Symbol into String)
|
936
862
|
# ENV # => {"bar"=>"1", "foo"=>"6"}
|
@@ -938,7 +864,7 @@ module RBS
|
|
938
864
|
# ENV # => {"bar"=>"1", "foo"=>"7"}
|
939
865
|
#
|
940
866
|
# Raises an exception if the block returns an invalid name: (see [Invalid Names
|
941
|
-
# and Values](
|
867
|
+
# and Values](rdoc-ref:ENV@Invalid+Names+and+Values)):
|
942
868
|
# ENV.merge!('bat' => '8', 'foo' => '9') { |name, env_val, hash_val | 10 } # Raises TypeError (no implicit conversion of Integer into String)
|
943
869
|
# ENV # => {"bar"=>"1", "bat"=>"8", "foo"=>"7"}
|
944
870
|
#
|
@@ -990,14 +916,14 @@ module RBS
|
|
990
916
|
# ENV.key('0') # => "foo"
|
991
917
|
#
|
992
918
|
# The order in which environment variables are examined is OS-dependent. See
|
993
|
-
# [About Ordering](
|
919
|
+
# [About Ordering](rdoc-ref:ENV@About+Ordering).
|
994
920
|
#
|
995
921
|
# Returns `nil` if there is no such value.
|
996
922
|
#
|
997
923
|
# Raises an exception if `value` is invalid:
|
998
924
|
# ENV.key(Object.new) # raises TypeError (no implicit conversion of Object into String)
|
999
925
|
#
|
1000
|
-
# See [Invalid Names and Values](
|
926
|
+
# See [Invalid Names and Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
1001
927
|
#
|
1002
928
|
%a{annotate:rdoc:copy:ENV.key}
|
1003
929
|
def key: (String value) -> String?
|
@@ -1050,7 +976,7 @@ module RBS
|
|
1050
976
|
# ENV.keys # => ['bar', 'foo']
|
1051
977
|
#
|
1052
978
|
# The order of the names is OS-dependent. See [About
|
1053
|
-
# Ordering](
|
979
|
+
# Ordering](rdoc-ref:ENV@About+Ordering).
|
1054
980
|
#
|
1055
981
|
# Returns the empty Array if ENV is empty.
|
1056
982
|
#
|
@@ -1066,7 +992,7 @@ module RBS
|
|
1066
992
|
# ENV.values # => ['1', '0']
|
1067
993
|
#
|
1068
994
|
# The order of the values is OS-dependent. See [About
|
1069
|
-
# Ordering](
|
995
|
+
# Ordering](rdoc-ref:ENV@About+Ordering).
|
1070
996
|
#
|
1071
997
|
# Returns the empty Array if ENV is empty.
|
1072
998
|
#
|
@@ -1088,7 +1014,7 @@ module RBS
|
|
1088
1014
|
# Returns an empty Array if no names given.
|
1089
1015
|
#
|
1090
1016
|
# Raises an exception if any name is invalid. See [Invalid Names and
|
1091
|
-
# Values](
|
1017
|
+
# Values](rdoc-ref:ENV@Invalid+Names+and+Values).
|
1092
1018
|
#
|
1093
1019
|
%a{annotate:rdoc:copy:ENV.values_at}
|
1094
1020
|
def values_at: (*String names) -> ::Array[String?]
|
@@ -1314,7 +1240,7 @@ module RBS
|
|
1314
1240
|
# ENV.rassoc('0') # => ["bar", "0"]
|
1315
1241
|
#
|
1316
1242
|
# The order in which environment variables are examined is OS-dependent. See
|
1317
|
-
# [About Ordering](
|
1243
|
+
# [About Ordering](rdoc-ref:ENV@About+Ordering).
|
1318
1244
|
#
|
1319
1245
|
# Returns `nil` if there is no such environment variable.
|
1320
1246
|
#
|
data/core/rbs/unnamed/random.rbs
CHANGED
@@ -85,7 +85,12 @@ module RBS
|
|
85
85
|
# <!-- rdoc-file=lib/random/formatter.rb -->
|
86
86
|
# ## Random number formatter.
|
87
87
|
#
|
88
|
-
# Formats generated random numbers in many manners.
|
88
|
+
# Formats generated random numbers in many manners. When `'random/formatter'` is
|
89
|
+
# required, several methods are added to empty core module `Random::Formatter`,
|
90
|
+
# making them available as Random's instance and module methods.
|
91
|
+
#
|
92
|
+
# Standard library SecureRandom is also extended with the module, and the
|
93
|
+
# methods described below are available as a module methods in it.
|
89
94
|
#
|
90
95
|
# ### Examples
|
91
96
|
#
|
@@ -93,30 +98,41 @@ module RBS
|
|
93
98
|
#
|
94
99
|
# require 'random/formatter'
|
95
100
|
#
|
101
|
+
# prng = Random.new
|
96
102
|
# prng.hex(10) #=> "52750b30ffbc7de3b362"
|
97
103
|
# prng.hex(10) #=> "92b15d6c8dc4beb5f559"
|
98
104
|
# prng.hex(13) #=> "39b290146bea6ce975c37cfc23"
|
105
|
+
# # or just
|
106
|
+
# Random.hex #=> "1aed0c631e41be7f77365415541052ee"
|
99
107
|
#
|
100
108
|
# Generate random base64 strings:
|
101
109
|
#
|
102
110
|
# prng.base64(10) #=> "EcmTPZwWRAozdA=="
|
103
111
|
# prng.base64(10) #=> "KO1nIU+p9DKxGg=="
|
104
112
|
# prng.base64(12) #=> "7kJSM/MzBJI+75j8"
|
113
|
+
# Random.base64(4) #=> "bsQ3fQ=="
|
105
114
|
#
|
106
115
|
# Generate random binary strings:
|
107
116
|
#
|
108
117
|
# prng.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
|
109
118
|
# prng.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
|
119
|
+
# Random.random_bytes(6) #=> "\xA1\xE6Lr\xC43"
|
110
120
|
#
|
111
121
|
# Generate alphanumeric strings:
|
112
122
|
#
|
113
123
|
# prng.alphanumeric(10) #=> "S8baxMJnPl"
|
114
124
|
# prng.alphanumeric(10) #=> "aOxAg8BAJe"
|
125
|
+
# Random.alphanumeric #=> "TmP9OsJHJLtaZYhP"
|
115
126
|
#
|
116
127
|
# Generate UUIDs:
|
117
128
|
#
|
118
129
|
# prng.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
|
119
130
|
# prng.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
|
131
|
+
# Random.uuid #=> "f14e0271-de96-45cc-8911-8910292a42cd"
|
132
|
+
#
|
133
|
+
# All methods are available in the standard library SecureRandom, too:
|
134
|
+
#
|
135
|
+
# SecureRandom.hex #=> "05b45376a30c67238eb93b16499e50cf"
|
120
136
|
#
|
121
137
|
# <!-- rdoc-file=random.c -->
|
122
138
|
# Generate a random number in the given range as Random does
|
@@ -134,7 +150,7 @@ module RBS
|
|
134
150
|
# rdoc-file=lib/random/formatter.rb
|
135
151
|
# - base64(n=nil)
|
136
152
|
# -->
|
137
|
-
#
|
153
|
+
# Generate a random base64 string.
|
138
154
|
#
|
139
155
|
# The argument *n* specifies the length, in bytes, of the random number to be
|
140
156
|
# generated. The length of the result string is about 4/3 of *n*.
|
@@ -146,7 +162,9 @@ module RBS
|
|
146
162
|
#
|
147
163
|
# require 'random/formatter'
|
148
164
|
#
|
149
|
-
#
|
165
|
+
# Random.base64 #=> "/2BuBuLf3+WfSKyQbRcc/A=="
|
166
|
+
# # or
|
167
|
+
# prng = Random.new
|
150
168
|
# prng.base64 #=> "6BbW0pxO0YENxn38HMUbcQ=="
|
151
169
|
#
|
152
170
|
# See RFC 3548 for the definition of base64.
|
@@ -158,7 +176,7 @@ module RBS
|
|
158
176
|
# rdoc-file=lib/random/formatter.rb
|
159
177
|
# - hex(n=nil)
|
160
178
|
# -->
|
161
|
-
#
|
179
|
+
# Generate a random hexadecimal string.
|
162
180
|
#
|
163
181
|
# The argument *n* specifies the length, in bytes, of the random number to be
|
164
182
|
# generated. The length of the resulting hexadecimal string is twice of *n*.
|
@@ -170,7 +188,9 @@ module RBS
|
|
170
188
|
#
|
171
189
|
# require 'random/formatter'
|
172
190
|
#
|
173
|
-
#
|
191
|
+
# Random.hex #=> "eb693ec8252cd630102fd0d0fb7c3485"
|
192
|
+
# # or
|
193
|
+
# prng = Random.new
|
174
194
|
# prng.hex #=> "91dc3bfb4de5b11d029d376634589b61"
|
175
195
|
#
|
176
196
|
%a{annotate:rdoc:copy:Random::Formatter#hex}
|
@@ -215,7 +235,7 @@ module RBS
|
|
215
235
|
# rdoc-file=lib/random/formatter.rb
|
216
236
|
# - urlsafe_base64(n=nil, padding=false)
|
217
237
|
# -->
|
218
|
-
#
|
238
|
+
# Generate a random URL-safe base64 string.
|
219
239
|
#
|
220
240
|
# The argument *n* specifies the length, in bytes, of the random number to be
|
221
241
|
# generated. The length of the result string is about 4/3 of *n*.
|
@@ -232,7 +252,9 @@ module RBS
|
|
232
252
|
#
|
233
253
|
# require 'random/formatter'
|
234
254
|
#
|
235
|
-
#
|
255
|
+
# Random.urlsafe_base64 #=> "b4GOKm4pOYU_-BOXcrUGDg"
|
256
|
+
# # or
|
257
|
+
# prng = Random.new
|
236
258
|
# prng.urlsafe_base64 #=> "UZLdOkzop70Ddx-IJR0ABg"
|
237
259
|
#
|
238
260
|
# prng.urlsafe_base64(nil, true) #=> "i0XQ-7gglIsHGV2_BNPrdQ=="
|
@@ -247,13 +269,14 @@ module RBS
|
|
247
269
|
# rdoc-file=lib/random/formatter.rb
|
248
270
|
# - uuid()
|
249
271
|
# -->
|
250
|
-
#
|
251
|
-
# IDentifier).
|
272
|
+
# Generate a random v4 UUID (Universally Unique IDentifier).
|
252
273
|
#
|
253
274
|
# require 'random/formatter'
|
254
275
|
#
|
255
|
-
#
|
256
|
-
#
|
276
|
+
# Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
|
277
|
+
# Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
|
278
|
+
# # or
|
279
|
+
# prng = Random.new
|
257
280
|
# prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
|
258
281
|
#
|
259
282
|
# The version 4 UUID is purely random (except the version). It doesn't contain
|
@@ -261,7 +284,8 @@ module RBS
|
|
261
284
|
#
|
262
285
|
# The result contains 122 random bits (15.25 random bytes).
|
263
286
|
#
|
264
|
-
# See
|
287
|
+
# See [RFC4122](https://datatracker.ietf.org/doc/html/rfc4122) for details of
|
288
|
+
# UUID.
|
265
289
|
#
|
266
290
|
%a{annotate:rdoc:copy:Random::Formatter#uuid}
|
267
291
|
def uuid: () -> String
|
data/core/refinement.rbs
CHANGED