rbs 3.3.2 → 3.4.0.pre.1
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 -5
- data/.github/workflows/ruby.yml +7 -8
- data/.github/workflows/typecheck.yml +37 -0
- data/CHANGELOG.md +50 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -11
- data/Steepfile +2 -2
- data/core/array.rbs +19 -49
- data/core/basic_object.rbs +2 -2
- data/core/comparable.rbs +17 -8
- data/core/complex.rbs +82 -43
- data/core/data.rbs +2 -4
- data/core/dir.rbs +635 -295
- data/core/enumerable.rbs +11 -18
- data/core/enumerator.rbs +37 -31
- data/core/errors.rbs +4 -0
- data/core/false_class.rbs +34 -15
- data/core/fiber.rbs +23 -0
- data/core/file.rbs +329 -120
- data/core/float.rbs +17 -32
- data/core/gc.rbs +17 -11
- data/core/hash.rbs +22 -44
- data/core/integer.rbs +82 -113
- data/core/io/buffer.rbs +90 -47
- data/core/io.rbs +39 -116
- data/core/kernel.rbs +442 -489
- data/core/match_data.rbs +55 -56
- data/core/module.rbs +45 -1
- data/core/nil_class.rbs +98 -35
- data/core/numeric.rbs +22 -32
- data/core/object_space/weak_key_map.rbs +102 -0
- data/core/process.rbs +1242 -655
- data/core/ractor.rbs +139 -120
- data/core/range.rbs +100 -4
- data/core/rational.rbs +0 -4
- data/core/rbs/unnamed/argf.rbs +16 -8
- data/core/rbs/unnamed/env_class.rbs +0 -24
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +1149 -598
- data/core/ruby_vm.rbs +126 -12
- data/core/rubygems/platform.rbs +9 -0
- data/core/rubygems/rubygems.rbs +1 -1
- data/core/rubygems/version.rbs +5 -1
- data/core/set.rbs +20 -22
- data/core/signal.rbs +4 -4
- data/core/string.rbs +283 -230
- data/core/string_io.rbs +2 -14
- data/core/struct.rbs +404 -24
- data/core/symbol.rbs +1 -19
- data/core/thread.rbs +29 -12
- data/core/time.rbs +227 -104
- data/core/trace_point.rbs +2 -5
- data/core/true_class.rbs +54 -21
- data/core/warning.rbs +14 -11
- data/docs/data_and_struct.md +29 -0
- data/docs/syntax.md +3 -5
- data/docs/tools.md +1 -0
- data/ext/rbs_extension/lexer.c +643 -559
- data/ext/rbs_extension/lexer.re +5 -1
- data/ext/rbs_extension/parser.c +12 -3
- data/ext/rbs_extension/unescape.c +7 -47
- data/lib/rbs/cli/diff.rb +4 -1
- data/lib/rbs/cli/validate.rb +280 -0
- data/lib/rbs/cli.rb +2 -194
- data/lib/rbs/collection/config.rb +5 -6
- data/lib/rbs/collection/sources/git.rb +1 -1
- data/lib/rbs/collection.rb +1 -0
- data/lib/rbs/diff.rb +7 -4
- data/lib/rbs/errors.rb +11 -0
- data/lib/rbs/test/errors.rb +4 -1
- data/lib/rbs/test/guaranteed.rb +2 -3
- data/lib/rbs/test/type_check.rb +15 -10
- data/lib/rbs/test.rb +3 -3
- data/lib/rbs/types.rb +29 -0
- data/lib/rbs/unit_test/convertibles.rb +176 -0
- data/lib/rbs/unit_test/spy.rb +136 -0
- data/lib/rbs/unit_test/type_assertions.rb +341 -0
- data/lib/rbs/unit_test/with_aliases.rb +143 -0
- data/lib/rbs/unit_test.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/cli/validate.rbs +43 -0
- data/sig/diff.rbs +3 -1
- data/sig/errors.rbs +8 -0
- data/sig/rbs.rbs +1 -1
- data/sig/test/errors.rbs +52 -0
- data/sig/test/guranteed.rbs +9 -0
- data/sig/test/type_check.rbs +19 -0
- data/sig/test.rbs +82 -0
- data/sig/types.rbs +6 -1
- data/sig/unit_test/convertibles.rbs +154 -0
- data/sig/unit_test/spy.rbs +28 -0
- data/sig/unit_test/type_assertions.rbs +194 -0
- data/sig/unit_test/with_aliases.rbs +136 -0
- data/stdlib/base64/0/base64.rbs +307 -45
- data/stdlib/bigdecimal/0/big_decimal.rbs +35 -15
- data/stdlib/coverage/0/coverage.rbs +2 -2
- data/stdlib/csv/0/csv.rbs +25 -55
- data/stdlib/date/0/date.rbs +1 -43
- data/stdlib/date/0/date_time.rbs +1 -13
- data/stdlib/delegate/0/delegator.rbs +186 -0
- data/stdlib/delegate/0/kernel.rbs +47 -0
- data/stdlib/delegate/0/simple_delegator.rbs +98 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
- data/stdlib/erb/0/erb.rbs +2 -2
- data/stdlib/fileutils/0/fileutils.rbs +0 -19
- data/stdlib/io-console/0/io-console.rbs +12 -1
- data/stdlib/ipaddr/0/ipaddr.rbs +2 -1
- data/stdlib/json/0/json.rbs +320 -81
- data/stdlib/logger/0/logger.rbs +9 -5
- data/stdlib/monitor/0/monitor.rbs +78 -0
- data/stdlib/net-http/0/net-http.rbs +1880 -543
- data/stdlib/objspace/0/objspace.rbs +19 -13
- data/stdlib/openssl/0/openssl.rbs +508 -127
- data/stdlib/optparse/0/optparse.rbs +25 -11
- data/stdlib/pathname/0/pathname.rbs +1 -1
- data/stdlib/pp/0/pp.rbs +2 -5
- data/stdlib/prettyprint/0/prettyprint.rbs +2 -2
- data/stdlib/pstore/0/pstore.rbs +2 -4
- data/stdlib/rdoc/0/comment.rbs +1 -2
- data/stdlib/resolv/0/resolv.rbs +4 -2
- data/stdlib/socket/0/socket.rbs +2 -2
- data/stdlib/socket/0/unix_socket.rbs +2 -2
- data/stdlib/strscan/0/string_scanner.rbs +3 -2
- data/stdlib/tempfile/0/tempfile.rbs +1 -1
- data/stdlib/uri/0/common.rbs +245 -123
- metadata +23 -4
- data/lib/rbs/test/spy.rb +0 -6
data/stdlib/uri/0/common.rbs
CHANGED
@@ -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
|
-
#
|
128
|
+
# Returns name/value pairs derived from the given string `str`, which must be an
|
129
|
+
# ASCII string.
|
129
130
|
#
|
130
|
-
#
|
131
|
-
#
|
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
|
-
#
|
134
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
187
|
+
# * Character `'+'` to character `' '`.
|
188
|
+
# * Each "percent notation" to an ASCII character.
|
154
189
|
#
|
155
|
-
#
|
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
|
-
#
|
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
|
-
#
|
166
|
-
# given an Enumerable object.
|
236
|
+
# Examples:
|
167
237
|
#
|
168
|
-
#
|
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
|
-
#
|
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
|
-
#
|
176
|
-
# multipart/form-data.
|
245
|
+
# URI.encode_www_form_component(ele[0])
|
177
246
|
#
|
178
|
-
#
|
247
|
+
# Example:
|
179
248
|
#
|
180
|
-
#
|
181
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
200
|
-
# (ASCII space) to + and converts others to %XX.
|
329
|
+
# Example:
|
201
330
|
#
|
202
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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
|
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
|
-
#
|
374
|
-
#
|
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
|
-
#
|
383
|
-
#
|
384
|
-
#
|
385
|
-
#
|
386
|
-
#
|
387
|
-
#
|
388
|
-
#
|
389
|
-
#
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
#
|
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
|
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.
|
4
|
+
version: 3.4.0.pre.1
|
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
|
+
date: 2023-12-19 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
|
@@ -176,6 +178,7 @@ files:
|
|
176
178
|
- lib/rbs/cli.rb
|
177
179
|
- lib/rbs/cli/colored_io.rb
|
178
180
|
- lib/rbs/cli/diff.rb
|
181
|
+
- lib/rbs/cli/validate.rb
|
179
182
|
- lib/rbs/collection.rb
|
180
183
|
- lib/rbs/collection/cleaner.rb
|
181
184
|
- lib/rbs/collection/config.rb
|
@@ -231,13 +234,17 @@ files:
|
|
231
234
|
- lib/rbs/test/observer.rb
|
232
235
|
- lib/rbs/test/setup.rb
|
233
236
|
- lib/rbs/test/setup_helper.rb
|
234
|
-
- lib/rbs/test/spy.rb
|
235
237
|
- lib/rbs/test/tester.rb
|
236
238
|
- lib/rbs/test/type_check.rb
|
237
239
|
- lib/rbs/type_alias_dependency.rb
|
238
240
|
- lib/rbs/type_alias_regularity.rb
|
239
241
|
- lib/rbs/type_name.rb
|
240
242
|
- lib/rbs/types.rb
|
243
|
+
- lib/rbs/unit_test.rb
|
244
|
+
- lib/rbs/unit_test/convertibles.rb
|
245
|
+
- lib/rbs/unit_test/spy.rb
|
246
|
+
- lib/rbs/unit_test/type_assertions.rb
|
247
|
+
- lib/rbs/unit_test/with_aliases.rb
|
241
248
|
- lib/rbs/validator.rb
|
242
249
|
- lib/rbs/variance_calculator.rb
|
243
250
|
- lib/rbs/vendorer.rb
|
@@ -267,6 +274,7 @@ files:
|
|
267
274
|
- sig/cli.rbs
|
268
275
|
- sig/cli/colored_io.rbs
|
269
276
|
- sig/cli/diff.rbs
|
277
|
+
- sig/cli/validate.rbs
|
270
278
|
- sig/collection.rbs
|
271
279
|
- sig/collection/cleaner.rbs
|
272
280
|
- sig/collection/config.rbs
|
@@ -312,11 +320,19 @@ files:
|
|
312
320
|
- sig/sorter.rbs
|
313
321
|
- sig/substitution.rbs
|
314
322
|
- sig/subtractor.rbs
|
323
|
+
- sig/test.rbs
|
324
|
+
- sig/test/errors.rbs
|
325
|
+
- sig/test/guranteed.rbs
|
326
|
+
- sig/test/type_check.rbs
|
315
327
|
- sig/type_alias_dependency.rbs
|
316
328
|
- sig/type_alias_regularity.rbs
|
317
329
|
- sig/type_param.rbs
|
318
330
|
- sig/typename.rbs
|
319
331
|
- sig/types.rbs
|
332
|
+
- sig/unit_test/convertibles.rbs
|
333
|
+
- sig/unit_test/spy.rbs
|
334
|
+
- sig/unit_test/type_assertions.rbs
|
335
|
+
- sig/unit_test/with_aliases.rbs
|
320
336
|
- sig/use_map.rbs
|
321
337
|
- sig/util.rbs
|
322
338
|
- sig/validator.rbs
|
@@ -340,6 +356,9 @@ files:
|
|
340
356
|
- stdlib/date/0/date_time.rbs
|
341
357
|
- stdlib/date/0/time.rbs
|
342
358
|
- stdlib/dbm/0/dbm.rbs
|
359
|
+
- stdlib/delegate/0/delegator.rbs
|
360
|
+
- stdlib/delegate/0/kernel.rbs
|
361
|
+
- stdlib/delegate/0/simple_delegator.rbs
|
343
362
|
- stdlib/did_you_mean/0/did_you_mean.rbs
|
344
363
|
- stdlib/digest/0/digest.rbs
|
345
364
|
- stdlib/erb/0/erb.rbs
|
@@ -509,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
509
528
|
- !ruby/object:Gem::Version
|
510
529
|
version: '0'
|
511
530
|
requirements: []
|
512
|
-
rubygems_version: 3.
|
531
|
+
rubygems_version: 3.5.0.dev
|
513
532
|
signing_key:
|
514
533
|
specification_version: 4
|
515
534
|
summary: Type signature for Ruby.
|