rbs 3.3.2 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -5
  3. data/.github/workflows/ruby.yml +7 -8
  4. data/.github/workflows/typecheck.yml +37 -0
  5. data/CHANGELOG.md +65 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +11 -11
  8. data/README.md +1 -0
  9. data/Rakefile +2 -2
  10. data/Steepfile +2 -2
  11. data/core/array.rbs +19 -49
  12. data/core/basic_object.rbs +2 -2
  13. data/core/comparable.rbs +17 -8
  14. data/core/complex.rbs +82 -43
  15. data/core/data.rbs +2 -4
  16. data/core/dir.rbs +635 -295
  17. data/core/enumerable.rbs +11 -18
  18. data/core/enumerator.rbs +37 -31
  19. data/core/errors.rbs +4 -0
  20. data/core/false_class.rbs +34 -15
  21. data/core/fiber.rbs +23 -0
  22. data/core/file.rbs +329 -120
  23. data/core/float.rbs +17 -32
  24. data/core/gc.rbs +17 -11
  25. data/core/hash.rbs +22 -44
  26. data/core/integer.rbs +82 -113
  27. data/core/io/buffer.rbs +90 -47
  28. data/core/io.rbs +54 -121
  29. data/core/kernel.rbs +442 -489
  30. data/core/match_data.rbs +55 -56
  31. data/core/module.rbs +45 -1
  32. data/core/nil_class.rbs +98 -35
  33. data/core/numeric.rbs +22 -32
  34. data/core/object_space/weak_key_map.rbs +102 -0
  35. data/core/process.rbs +1242 -655
  36. data/core/ractor.rbs +139 -120
  37. data/core/range.rbs +100 -4
  38. data/core/rational.rbs +0 -4
  39. data/core/rbs/unnamed/argf.rbs +16 -8
  40. data/core/rbs/unnamed/env_class.rbs +0 -24
  41. data/core/refinement.rbs +8 -0
  42. data/core/regexp.rbs +1149 -598
  43. data/core/ruby_vm.rbs +126 -12
  44. data/core/rubygems/platform.rbs +9 -0
  45. data/core/rubygems/rubygems.rbs +1 -1
  46. data/core/rubygems/version.rbs +5 -1
  47. data/core/set.rbs +20 -22
  48. data/core/signal.rbs +4 -4
  49. data/core/string.rbs +283 -230
  50. data/core/string_io.rbs +2 -14
  51. data/core/struct.rbs +404 -24
  52. data/core/symbol.rbs +1 -19
  53. data/core/thread.rbs +29 -12
  54. data/core/time.rbs +227 -104
  55. data/core/trace_point.rbs +2 -5
  56. data/core/true_class.rbs +54 -21
  57. data/core/warning.rbs +14 -11
  58. data/docs/data_and_struct.md +29 -0
  59. data/docs/gem.md +58 -0
  60. data/docs/syntax.md +3 -5
  61. data/docs/tools.md +1 -0
  62. data/ext/rbs_extension/lexer.c +643 -559
  63. data/ext/rbs_extension/lexer.re +5 -1
  64. data/ext/rbs_extension/parser.c +12 -3
  65. data/ext/rbs_extension/unescape.c +7 -47
  66. data/lib/rbs/cli/diff.rb +4 -1
  67. data/lib/rbs/cli/validate.rb +280 -0
  68. data/lib/rbs/cli.rb +2 -194
  69. data/lib/rbs/collection/config.rb +5 -6
  70. data/lib/rbs/collection/sources/git.rb +1 -1
  71. data/lib/rbs/collection.rb +1 -0
  72. data/lib/rbs/diff.rb +7 -4
  73. data/lib/rbs/errors.rb +11 -0
  74. data/lib/rbs/test/errors.rb +10 -2
  75. data/lib/rbs/test/guaranteed.rb +2 -3
  76. data/lib/rbs/test/type_check.rb +15 -10
  77. data/lib/rbs/test.rb +3 -3
  78. data/lib/rbs/types.rb +29 -0
  79. data/lib/rbs/unit_test/convertibles.rb +176 -0
  80. data/lib/rbs/unit_test/spy.rb +136 -0
  81. data/lib/rbs/unit_test/type_assertions.rb +341 -0
  82. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  83. data/lib/rbs/unit_test.rb +6 -0
  84. data/lib/rbs/version.rb +1 -1
  85. data/sig/cli/validate.rbs +43 -0
  86. data/sig/diff.rbs +3 -1
  87. data/sig/errors.rbs +8 -0
  88. data/sig/rbs.rbs +1 -1
  89. data/sig/test/errors.rbs +52 -0
  90. data/sig/test/guranteed.rbs +9 -0
  91. data/sig/test/type_check.rbs +19 -0
  92. data/sig/test.rbs +82 -0
  93. data/sig/types.rbs +6 -1
  94. data/sig/unit_test/convertibles.rbs +154 -0
  95. data/sig/unit_test/spy.rbs +28 -0
  96. data/sig/unit_test/type_assertions.rbs +194 -0
  97. data/sig/unit_test/with_aliases.rbs +136 -0
  98. data/stdlib/base64/0/base64.rbs +307 -45
  99. data/stdlib/bigdecimal/0/big_decimal.rbs +35 -15
  100. data/stdlib/coverage/0/coverage.rbs +2 -2
  101. data/stdlib/csv/0/csv.rbs +25 -55
  102. data/stdlib/date/0/date.rbs +1 -43
  103. data/stdlib/date/0/date_time.rbs +1 -13
  104. data/stdlib/delegate/0/delegator.rbs +186 -0
  105. data/stdlib/delegate/0/kernel.rbs +47 -0
  106. data/stdlib/delegate/0/simple_delegator.rbs +98 -0
  107. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
  108. data/stdlib/erb/0/erb.rbs +2 -2
  109. data/stdlib/fileutils/0/fileutils.rbs +0 -19
  110. data/stdlib/io-console/0/io-console.rbs +12 -1
  111. data/stdlib/ipaddr/0/ipaddr.rbs +2 -1
  112. data/stdlib/json/0/json.rbs +320 -81
  113. data/stdlib/logger/0/logger.rbs +9 -5
  114. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +6 -6
  115. data/stdlib/monitor/0/monitor.rbs +78 -0
  116. data/stdlib/net-http/0/net-http.rbs +1880 -543
  117. data/stdlib/objspace/0/objspace.rbs +19 -13
  118. data/stdlib/openssl/0/openssl.rbs +508 -127
  119. data/stdlib/optparse/0/optparse.rbs +25 -11
  120. data/stdlib/pathname/0/pathname.rbs +1 -1
  121. data/stdlib/pp/0/pp.rbs +2 -5
  122. data/stdlib/prettyprint/0/prettyprint.rbs +2 -2
  123. data/stdlib/pstore/0/pstore.rbs +2 -4
  124. data/stdlib/rdoc/0/comment.rbs +1 -2
  125. data/stdlib/resolv/0/resolv.rbs +4 -2
  126. data/stdlib/socket/0/socket.rbs +2 -2
  127. data/stdlib/socket/0/unix_socket.rbs +2 -2
  128. data/stdlib/strscan/0/string_scanner.rbs +3 -2
  129. data/stdlib/tempfile/0/tempfile.rbs +1 -1
  130. data/stdlib/uri/0/common.rbs +245 -123
  131. metadata +24 -4
  132. data/lib/rbs/test/spy.rb +0 -6
@@ -125,22 +125,37 @@ module URI
125
125
  # rdoc-file=lib/uri/common.rb
126
126
  # - decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
127
127
  # -->
128
- # Decodes URL-encoded form data from given `str`.
128
+ # Returns name/value pairs derived from the given string `str`, which must be an
129
+ # ASCII string.
129
130
  #
130
- # This decodes application/x-www-form-urlencoded data and returns an array of
131
- # key-value arrays.
131
+ # The method may be used to decode the body of Net::HTTPResponse object `res`
132
+ # for which `res['Content-Type']` is `'application/x-www-form-urlencoded'`.
132
133
  #
133
- # This refers http://url.spec.whatwg.org/#concept-urlencoded-parser, so this
134
- # supports only &-separator, and doesn't support ;-separator.
134
+ # The returned data is an array of 2-element subarrays; each subarray is a
135
+ # name/value pair (both are strings). Each returned string has encoding `enc`,
136
+ # and has had invalid characters removed via
137
+ # [String#scrub](rdoc-ref:String#scrub).
135
138
  #
136
- # ary = URI.decode_www_form("a=1&a=2&b=3")
137
- # ary #=> [['a', '1'], ['a', '2'], ['b', '3']]
138
- # ary.assoc('a').last #=> '1'
139
- # ary.assoc('b').last #=> '3'
140
- # ary.rassoc('a').last #=> '2'
141
- # Hash[ary] #=> {"a"=>"2", "b"=>"3"}
139
+ # A simple example:
142
140
  #
143
- # See URI.decode_www_form_component, URI.encode_www_form.
141
+ # URI.decode_www_form('foo=0&bar=1&baz')
142
+ # # => [["foo", "0"], ["bar", "1"], ["baz", ""]]
143
+ #
144
+ # The returned strings have certain conversions, similar to those performed in
145
+ # URI.decode_www_form_component:
146
+ #
147
+ # URI.decode_www_form('f%23o=%2F&b-r=%24&b+z=%40')
148
+ # # => [["f#o", "/"], ["b-r", "$"], ["b z", "@"]]
149
+ #
150
+ # The given string may contain consecutive separators:
151
+ #
152
+ # URI.decode_www_form('foo=0&&bar=1&&baz=2')
153
+ # # => [["foo", "0"], ["", ""], ["bar", "1"], ["", ""], ["baz", "2"]]
154
+ #
155
+ # A different separator may be specified:
156
+ #
157
+ # URI.decode_www_form('foo=0--bar=1--baz', separator: '--')
158
+ # # => [["foo", "0"], ["bar", "1"], ["baz", ""]]
144
159
  #
145
160
  def self.decode_www_form: (String str, ?encoding enc, ?isindex: boolish, ?use__charset_: boolish, ?separator: String) -> Array[[ String, String ]]
146
161
 
@@ -148,11 +163,38 @@ module URI
148
163
  # rdoc-file=lib/uri/common.rb
149
164
  # - decode_www_form_component(str, enc=Encoding::UTF_8)
150
165
  # -->
151
- # Decodes given `str` of URL-encoded form data.
166
+ # Returns a string decoded from the given URL-encoded string `str`.
167
+ #
168
+ # The given string is first encoded as Encoding::ASCII-8BIT (using String#b),
169
+ # then decoded (as below), and finally force-encoded to the given encoding
170
+ # `enc`.
171
+ #
172
+ # The returned string:
173
+ #
174
+ # * Preserves:
175
+ #
176
+ # * Characters `'*'`, `'.'`, `'-'`, and `'_'`.
177
+ # * Character in ranges `'a'..'z'`, `'A'..'Z'`, and `'0'..'9'`.
178
+ #
179
+ #
180
+ # Example:
181
+ #
182
+ # URI.decode_www_form_component('*.-_azAZ09')
183
+ # # => "*.-_azAZ09"
184
+ #
185
+ # * Converts:
152
186
  #
153
- # This decodes + to SP.
187
+ # * Character `'+'` to character `' '`.
188
+ # * Each "percent notation" to an ASCII character.
154
189
  #
155
- # See URI.encode_www_form_component, URI.decode_www_form.
190
+ #
191
+ # Example:
192
+ #
193
+ # URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A')
194
+ # # => "Here are some punctuation characters: ,;?:"
195
+ #
196
+ #
197
+ # Related: URI.decode_uri_component (preserves `'+'`).
156
198
  #
157
199
  def self.decode_www_form_component: (String str, ?encoding enc) -> String
158
200
 
@@ -160,33 +202,101 @@ module URI
160
202
  # rdoc-file=lib/uri/common.rb
161
203
  # - encode_www_form(enum, enc=nil)
162
204
  # -->
163
- # Generates URL-encoded form data from given `enum`.
205
+ # Returns a URL-encoded string derived from the given
206
+ # [Enumerable](rdoc-ref:Enumerable@Enumerable+in+Ruby+Classes) `enum`.
207
+ #
208
+ # The result is suitable for use as form data for an HTTP request whose
209
+ # `Content-Type` is `'application/x-www-form-urlencoded'`.
210
+ #
211
+ # The returned string consists of the elements of `enum`, each converted to one
212
+ # or more URL-encoded strings, and all joined with character `'&'`.
213
+ #
214
+ # Simple examples:
215
+ #
216
+ # URI.encode_www_form([['foo', 0], ['bar', 1], ['baz', 2]])
217
+ # # => "foo=0&bar=1&baz=2"
218
+ # URI.encode_www_form({foo: 0, bar: 1, baz: 2})
219
+ # # => "foo=0&bar=1&baz=2"
220
+ #
221
+ # The returned string is formed using method URI.encode_www_form_component,
222
+ # which converts certain characters:
223
+ #
224
+ # URI.encode_www_form('f#o': '/', 'b-r': '$', 'b z': '@')
225
+ # # => "f%23o=%2F&b-r=%24&b+z=%40"
226
+ #
227
+ # When `enum` is Array-like, each element `ele` is converted to a field:
228
+ #
229
+ # * If `ele` is an array of two or more elements, the field is formed from its
230
+ # first two elements (and any additional elements are ignored):
231
+ #
232
+ # name = URI.encode_www_form_component(ele[0], enc)
233
+ # value = URI.encode_www_form_component(ele[1], enc)
234
+ # "#{name}=#{value}"
164
235
  #
165
- # This generates application/x-www-form-urlencoded data defined in HTML5 from
166
- # given an Enumerable object.
236
+ # Examples:
167
237
  #
168
- # This internally uses URI.encode_www_form_component(str).
238
+ # URI.encode_www_form([%w[foo bar], %w[baz bat bah]])
239
+ # # => "foo=bar&baz=bat"
240
+ # URI.encode_www_form([['foo', 0], ['bar', :baz, 'bat']])
241
+ # # => "foo=0&bar=baz"
169
242
  #
170
- # This method doesn't convert the encoding of given items, so convert them
171
- # before calling this method if you want to send data as other than original
172
- # encoding or mixed encoding data. (Strings which are encoded in an HTML5 ASCII
173
- # incompatible encoding are converted to UTF-8.)
243
+ # * If `ele` is an array of one element, the field is formed from `ele[0]`:
174
244
  #
175
- # This method doesn't handle files. When you send a file, use
176
- # multipart/form-data.
245
+ # URI.encode_www_form_component(ele[0])
177
246
  #
178
- # This refers https://url.spec.whatwg.org/#concept-urlencoded-serializer
247
+ # Example:
179
248
  #
180
- # URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
181
- # #=> "q=ruby&lang=en"
182
- # URI.encode_www_form("q" => "ruby", "lang" => "en")
183
- # #=> "q=ruby&lang=en"
184
- # URI.encode_www_form("q" => ["ruby", "perl"], "lang" => "en")
185
- # #=> "q=ruby&q=perl&lang=en"
186
- # URI.encode_www_form([["q", "ruby"], ["q", "perl"], ["lang", "en"]])
187
- # #=> "q=ruby&q=perl&lang=en"
249
+ # URI.encode_www_form([['foo'], [:bar], [0]])
250
+ # # => "foo&bar&0"
188
251
  #
189
- # See URI.encode_www_form_component, URI.decode_www_form.
252
+ # * Otherwise the field is formed from `ele`:
253
+ #
254
+ # URI.encode_www_form_component(ele)
255
+ #
256
+ # Example:
257
+ #
258
+ # URI.encode_www_form(['foo', :bar, 0])
259
+ # # => "foo&bar&0"
260
+ #
261
+ #
262
+ # The elements of an Array-like `enum` may be mixture:
263
+ #
264
+ # URI.encode_www_form([['foo', 0], ['bar', 1, 2], ['baz'], :bat])
265
+ # # => "foo=0&bar=1&baz&bat"
266
+ #
267
+ # When `enum` is Hash-like, each `key`/`value` pair is converted to one or more
268
+ # fields:
269
+ #
270
+ # * If `value` is
271
+ # [Array-convertible](rdoc-ref:implicit_conversion.rdoc@Array-Convertible+Ob
272
+ # jects), each element `ele` in `value` is paired with `key` to form a
273
+ # field:
274
+ #
275
+ # name = URI.encode_www_form_component(key, enc)
276
+ # value = URI.encode_www_form_component(ele, enc)
277
+ # "#{name}=#{value}"
278
+ #
279
+ # Example:
280
+ #
281
+ # URI.encode_www_form({foo: [:bar, 1], baz: [:bat, :bam, 2]})
282
+ # # => "foo=bar&foo=1&baz=bat&baz=bam&baz=2"
283
+ #
284
+ # * Otherwise, `key` and `value` are paired to form a field:
285
+ #
286
+ # name = URI.encode_www_form_component(key, enc)
287
+ # value = URI.encode_www_form_component(value, enc)
288
+ # "#{name}=#{value}"
289
+ #
290
+ # Example:
291
+ #
292
+ # URI.encode_www_form({foo: 0, bar: 1, baz: 2})
293
+ # # => "foo=0&bar=1&baz=2"
294
+ #
295
+ #
296
+ # The elements of a Hash-like `enum` may be mixture:
297
+ #
298
+ # URI.encode_www_form({foo: [0, 1], bar: 2})
299
+ # # => "foo=0&foo=1&bar=2"
190
300
  #
191
301
  def self.encode_www_form: (Enumerable[[ _ToS, _ToS ]] enum, ?encoding? enc) -> String
192
302
 
@@ -194,17 +304,44 @@ module URI
194
304
  # rdoc-file=lib/uri/common.rb
195
305
  # - encode_www_form_component(str, enc=nil)
196
306
  # -->
197
- # Encodes given `str` to URL-encoded form data.
307
+ # Returns a URL-encoded string derived from the given string `str`.
308
+ #
309
+ # The returned string:
310
+ #
311
+ # * Preserves:
312
+ #
313
+ # * Characters `'*'`, `'.'`, `'-'`, and `'_'`.
314
+ # * Character in ranges `'a'..'z'`, `'A'..'Z'`, and `'0'..'9'`.
315
+ #
316
+ #
317
+ # Example:
318
+ #
319
+ # URI.encode_www_form_component('*.-_azAZ09')
320
+ # # => "*.-_azAZ09"
321
+ #
322
+ # * Converts:
323
+ #
324
+ # * Character `' '` to character `'+'`.
325
+ # * Any other character to "percent notation"; the percent notation for
326
+ # character *c* is `'%%%X' % c.ord`.
327
+ #
198
328
  #
199
- # This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
200
- # (ASCII space) to + and converts others to %XX.
329
+ # Example:
201
330
  #
202
- # If `enc` is given, convert `str` to the encoding before percent encoding.
331
+ # URI.encode_www_form_component('Here are some punctuation characters: ,;?:')
332
+ # # => "Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A"
203
333
  #
204
- # This is an implementation of
205
- # https://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
206
334
  #
207
- # See URI.decode_www_form_component, URI.encode_www_form.
335
+ # Encoding:
336
+ #
337
+ # * If `str` has encoding Encoding::ASCII_8BIT, argument `enc` is ignored.
338
+ # * Otherwise `str` is converted first to Encoding::UTF_8 (with suitable
339
+ # character replacements), and then to encoding `enc`.
340
+ #
341
+ #
342
+ # In either case, the returned string has forced encoding Encoding::US_ASCII.
343
+ #
344
+ # Related: URI.encode_uri_component (encodes `' '` as `'%20'`).
208
345
  #
209
346
  def self.encode_www_form_component: (_ToS str, ?encoding? enc) -> String
210
347
 
@@ -245,23 +382,13 @@ module URI
245
382
  # rdoc-file=lib/uri/common.rb
246
383
  # - join(*str)
247
384
  # -->
248
- # ## Synopsis
249
- #
250
- # URI::join(str[, str, ...])
251
- #
252
- # ## Args
253
- #
254
- # `str`
255
- # : String(s) to work with, will be converted to RFC3986 URIs before merging.
385
+ # Merges the given URI strings `str` per [RFC
386
+ # 2396](https://www.rfc-editor.org/rfc/rfc2396.html).
256
387
  #
388
+ # Each string in `str` is converted to an [RFC3986
389
+ # URI](https://www.rfc-editor.org/rfc/rfc3986.html) before being merged.
257
390
  #
258
- # ## Description
259
- #
260
- # Joins URIs.
261
- #
262
- # ## Usage
263
- #
264
- # require 'uri'
391
+ # Examples:
265
392
  #
266
393
  # URI.join("http://example.com/","main.rbx")
267
394
  # # => #<URI::HTTP http://example.com/main.rbx>
@@ -284,39 +411,15 @@ module URI
284
411
  # rdoc-file=lib/uri/common.rb
285
412
  # - parse(uri)
286
413
  # -->
287
- # ## Synopsis
288
- #
289
- # URI::parse(uri_str)
290
- #
291
- # ## Args
292
- #
293
- # `uri_str`
294
- # : String with URI.
295
- #
296
- #
297
- # ## Description
298
- #
299
- # Creates one of the URI's subclasses instance from the string.
300
- #
301
- # ## Raises
302
- #
303
- # URI::InvalidURIError
304
- # : Raised if URI given is not a correct one.
414
+ # Returns a new URI object constructed from the given string `uri`:
305
415
  #
416
+ # URI.parse('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
417
+ # # => #<URI::HTTPS https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
418
+ # URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
419
+ # # => #<URI::HTTP http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
306
420
  #
307
- # ## Usage
308
- #
309
- # require 'uri'
310
- #
311
- # uri = URI.parse("http://www.ruby-lang.org/")
312
- # # => #<URI::HTTP http://www.ruby-lang.org/>
313
- # uri.scheme
314
- # # => "http"
315
- # uri.host
316
- # # => "www.ruby-lang.org"
317
- #
318
- # It's recommended to first ::escape the provided `uri_str` if there are any
319
- # invalid URI characters.
421
+ # It's recommended to first ::escape string `uri` if it may contain invalid URI
422
+ # characters.
320
423
  #
321
424
  def self.parse: (_ToStr uri) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic)
322
425
 
@@ -362,7 +465,20 @@ module URI
362
465
  # rdoc-file=lib/uri/common.rb
363
466
  # - scheme_list()
364
467
  # -->
365
- # Returns a Hash of the defined schemes.
468
+ # Returns a hash of the defined schemes:
469
+ #
470
+ # URI.scheme_list
471
+ # # =>
472
+ # {"MAILTO"=>URI::MailTo,
473
+ # "LDAPS"=>URI::LDAPS,
474
+ # "WS"=>URI::WS,
475
+ # "HTTP"=>URI::HTTP,
476
+ # "HTTPS"=>URI::HTTPS,
477
+ # "LDAP"=>URI::LDAP,
478
+ # "FILE"=>URI::File,
479
+ # "FTP"=>URI::FTP}
480
+ #
481
+ # Related: URI.register_scheme.
366
482
  #
367
483
  def self.scheme_list: () -> Hash[String, Class]
368
484
 
@@ -370,8 +486,21 @@ module URI
370
486
  # rdoc-file=lib/uri/common.rb
371
487
  # - for(scheme, *arguments, default: Generic)
372
488
  # -->
373
- # Construct a URI instance, using the scheme to detect the appropriate class
374
- # from `URI.scheme_list`.
489
+ # Returns a new object constructed from the given `scheme`, `arguments`, and
490
+ # `default`:
491
+ #
492
+ # * The new object is an instance of `URI.scheme_list[scheme.upcase]`.
493
+ # * The object is initialized by calling the class initializer using `scheme`
494
+ # and `arguments`. See URI::Generic.new.
495
+ #
496
+ #
497
+ # Examples:
498
+ #
499
+ # values = ['john.doe', 'www.example.com', '123', nil, '/forum/questions/', nil, 'tag=networking&order=newest', 'top']
500
+ # URI.for('https', *values)
501
+ # # => #<URI::HTTPS https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
502
+ # URI.for('foo', *values, default: URI::HTTP)
503
+ # # => #<URI::HTTP foo://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
375
504
  #
376
505
  def self.for: (String scheme, *untyped arguments, ?default: Class) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic)
377
506
 
@@ -379,37 +508,22 @@ module URI
379
508
  # rdoc-file=lib/uri/common.rb
380
509
  # - split(uri)
381
510
  # -->
382
- # ## Synopsis
383
- #
384
- # URI::split(uri)
385
- #
386
- # ## Args
387
- #
388
- # `uri`
389
- # : String with URI.
390
- #
391
- #
392
- # ## Description
393
- #
394
- # Splits the string on following parts and returns array with result:
395
- #
396
- # * Scheme
397
- # * Userinfo
398
- # * Host
399
- # * Port
400
- # * Registry
401
- # * Path
402
- # * Opaque
403
- # * Query
404
- # * Fragment
405
- #
406
- #
407
- # ## Usage
408
- #
409
- # require 'uri'
410
- #
411
- # URI.split("http://www.ruby-lang.org/")
412
- # # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
511
+ # Returns a 9-element array representing the parts of the URI formed from the
512
+ # string `uri`; each array element is a string or `nil`:
513
+ #
514
+ # names = %w[scheme userinfo host port registry path opaque query fragment]
515
+ # values = URI.split('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
516
+ # names.zip(values)
517
+ # # =>
518
+ # [["scheme", "https"],
519
+ # ["userinfo", "john.doe"],
520
+ # ["host", "www.example.com"],
521
+ # ["port", "123"],
522
+ # ["registry", nil],
523
+ # ["path", "/forum/questions/"],
524
+ # ["opaque", nil],
525
+ # ["query", "tag=networking&order=newest"],
526
+ # ["fragment", "top"]]
413
527
  #
414
528
  def self.split: (_ToStr uri) -> [ String?, String?, String?, String?, nil, String?, String?, String?, String? ]
415
529
  end
@@ -473,7 +587,15 @@ module Kernel
473
587
  # rdoc-file=lib/uri/common.rb
474
588
  # - URI(uri)
475
589
  # -->
476
- # Returns `uri` converted to an URI object.
590
+ # Returns a URI object derived from the given `uri`, which may be a URI string
591
+ # or an existing URI object:
592
+ #
593
+ # # Returns a new URI.
594
+ # uri = URI('http://github.com/ruby/ruby')
595
+ # # => #<URI::HTTP http://github.com/ruby/ruby>
596
+ # # Returns the given URI.
597
+ # URI(uri)
598
+ # # => #<URI::HTTP http://github.com/ruby/ruby>
477
599
  #
478
600
  def self?.URI: (URI::Generic | String uri) -> URI::Generic
479
601
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-21 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abbrev
@@ -37,6 +37,7 @@ files:
37
37
  - ".github/dependabot.yml"
38
38
  - ".github/workflows/comments.yml"
39
39
  - ".github/workflows/ruby.yml"
40
+ - ".github/workflows/typecheck.yml"
40
41
  - ".gitignore"
41
42
  - ".rubocop.yml"
42
43
  - BSDL
@@ -88,6 +89,7 @@ files:
88
89
  - core/numeric.rbs
89
90
  - core/object.rbs
90
91
  - core/object_space.rbs
92
+ - core/object_space/weak_key_map.rbs
91
93
  - core/proc.rbs
92
94
  - core/process.rbs
93
95
  - core/ractor.rbs
@@ -132,6 +134,7 @@ files:
132
134
  - docs/CONTRIBUTING.md
133
135
  - docs/collection.md
134
136
  - docs/data_and_struct.md
137
+ - docs/gem.md
135
138
  - docs/rbs_by_example.md
136
139
  - docs/repo.md
137
140
  - docs/sigs.md
@@ -176,6 +179,7 @@ files:
176
179
  - lib/rbs/cli.rb
177
180
  - lib/rbs/cli/colored_io.rb
178
181
  - lib/rbs/cli/diff.rb
182
+ - lib/rbs/cli/validate.rb
179
183
  - lib/rbs/collection.rb
180
184
  - lib/rbs/collection/cleaner.rb
181
185
  - lib/rbs/collection/config.rb
@@ -231,13 +235,17 @@ files:
231
235
  - lib/rbs/test/observer.rb
232
236
  - lib/rbs/test/setup.rb
233
237
  - lib/rbs/test/setup_helper.rb
234
- - lib/rbs/test/spy.rb
235
238
  - lib/rbs/test/tester.rb
236
239
  - lib/rbs/test/type_check.rb
237
240
  - lib/rbs/type_alias_dependency.rb
238
241
  - lib/rbs/type_alias_regularity.rb
239
242
  - lib/rbs/type_name.rb
240
243
  - lib/rbs/types.rb
244
+ - lib/rbs/unit_test.rb
245
+ - lib/rbs/unit_test/convertibles.rb
246
+ - lib/rbs/unit_test/spy.rb
247
+ - lib/rbs/unit_test/type_assertions.rb
248
+ - lib/rbs/unit_test/with_aliases.rb
241
249
  - lib/rbs/validator.rb
242
250
  - lib/rbs/variance_calculator.rb
243
251
  - lib/rbs/vendorer.rb
@@ -267,6 +275,7 @@ files:
267
275
  - sig/cli.rbs
268
276
  - sig/cli/colored_io.rbs
269
277
  - sig/cli/diff.rbs
278
+ - sig/cli/validate.rbs
270
279
  - sig/collection.rbs
271
280
  - sig/collection/cleaner.rbs
272
281
  - sig/collection/config.rbs
@@ -312,11 +321,19 @@ files:
312
321
  - sig/sorter.rbs
313
322
  - sig/substitution.rbs
314
323
  - sig/subtractor.rbs
324
+ - sig/test.rbs
325
+ - sig/test/errors.rbs
326
+ - sig/test/guranteed.rbs
327
+ - sig/test/type_check.rbs
315
328
  - sig/type_alias_dependency.rbs
316
329
  - sig/type_alias_regularity.rbs
317
330
  - sig/type_param.rbs
318
331
  - sig/typename.rbs
319
332
  - sig/types.rbs
333
+ - sig/unit_test/convertibles.rbs
334
+ - sig/unit_test/spy.rbs
335
+ - sig/unit_test/type_assertions.rbs
336
+ - sig/unit_test/with_aliases.rbs
320
337
  - sig/use_map.rbs
321
338
  - sig/util.rbs
322
339
  - sig/validator.rbs
@@ -340,6 +357,9 @@ files:
340
357
  - stdlib/date/0/date_time.rbs
341
358
  - stdlib/date/0/time.rbs
342
359
  - stdlib/dbm/0/dbm.rbs
360
+ - stdlib/delegate/0/delegator.rbs
361
+ - stdlib/delegate/0/kernel.rbs
362
+ - stdlib/delegate/0/simple_delegator.rbs
343
363
  - stdlib/did_you_mean/0/did_you_mean.rbs
344
364
  - stdlib/digest/0/digest.rbs
345
365
  - stdlib/erb/0/erb.rbs
@@ -509,7 +529,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
509
529
  - !ruby/object:Gem::Version
510
530
  version: '0'
511
531
  requirements: []
512
- rubygems_version: 3.4.10
532
+ rubygems_version: 3.5.0.dev
513
533
  signing_key:
514
534
  specification_version: 4
515
535
  summary: Type signature for Ruby.
data/lib/rbs/test/spy.rb DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RBS
4
- module Test
5
- end
6
- end