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.
- 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 +65 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -11
- data/README.md +1 -0
- data/Rakefile +2 -2
- 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 +54 -121
- 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/gem.md +58 -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 +10 -2
- 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/minitest/0/minitest/test/lifecycle_hooks.rbs +6 -6
- 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 +24 -4
- data/lib/rbs/test/spy.rb +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# <!-- rdoc-file=lib/optparse.rb -->
|
|
2
2
|
# ## OptionParser
|
|
3
3
|
#
|
|
4
|
-
# ### New to OptionParser
|
|
4
|
+
# ### New to `OptionParser`?
|
|
5
5
|
#
|
|
6
6
|
# See the [Tutorial](optparse/tutorial.rdoc).
|
|
7
7
|
#
|
|
@@ -106,13 +106,17 @@
|
|
|
106
106
|
# OptionParser supports the ability to coerce command line arguments into
|
|
107
107
|
# objects for us.
|
|
108
108
|
#
|
|
109
|
-
# OptionParser comes with a few ready-to-use kinds of
|
|
110
|
-
#
|
|
111
|
-
# * Date -- Anything accepted by `Date.parse`
|
|
112
|
-
#
|
|
113
|
-
# *
|
|
114
|
-
#
|
|
115
|
-
# *
|
|
109
|
+
# OptionParser comes with a few ready-to-use kinds of type coercion. They are:
|
|
110
|
+
#
|
|
111
|
+
# * Date -- Anything accepted by `Date.parse` (need to require
|
|
112
|
+
# `optparse/date`)
|
|
113
|
+
# * DateTime -- Anything accepted by `DateTime.parse` (need to require
|
|
114
|
+
# `optparse/date`)
|
|
115
|
+
# * Time -- Anything accepted by `Time.httpdate` or `Time.parse` (need to
|
|
116
|
+
# require `optparse/time`)
|
|
117
|
+
# * URI -- Anything accepted by `URI.parse` (need to require `optparse/uri`)
|
|
118
|
+
# * Shellwords -- Anything accepted by `Shellwords.shellwords` (need to
|
|
119
|
+
# require `optparse/shellwords`)
|
|
116
120
|
# * String -- Any non-empty string
|
|
117
121
|
# * Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040)
|
|
118
122
|
# * Float -- Any float. (e.g. 10, 3.14, -100E+13)
|
|
@@ -400,7 +404,7 @@ class OptionParser
|
|
|
400
404
|
|
|
401
405
|
# <!--
|
|
402
406
|
# rdoc-file=lib/optparse.rb
|
|
403
|
-
# - getopts(*args)
|
|
407
|
+
# - getopts(*args, symbolize_names: false)
|
|
404
408
|
# -->
|
|
405
409
|
# See #getopts.
|
|
406
410
|
#
|
|
@@ -598,7 +602,7 @@ class OptionParser
|
|
|
598
602
|
|
|
599
603
|
# <!--
|
|
600
604
|
# rdoc-file=lib/optparse.rb
|
|
601
|
-
# - getopts(*args)
|
|
605
|
+
# - getopts(*args, symbolize_names: false)
|
|
602
606
|
# -->
|
|
603
607
|
# Wrapper method for getopts.rb.
|
|
604
608
|
#
|
|
@@ -609,6 +613,16 @@ class OptionParser
|
|
|
609
613
|
# # params["bar"] = "x" # --bar x
|
|
610
614
|
# # params["zot"] = "z" # --zot Z
|
|
611
615
|
#
|
|
616
|
+
# Option `symbolize_names` (boolean) specifies whether returned Hash keys should
|
|
617
|
+
# be Symbols; defaults to `false` (use Strings).
|
|
618
|
+
#
|
|
619
|
+
# params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option", symbolize_names: true)
|
|
620
|
+
# # params[:a] = true # -a
|
|
621
|
+
# # params[:b] = "1" # -b1
|
|
622
|
+
# # params[:foo] = "1" # --foo
|
|
623
|
+
# # params[:bar] = "x" # --bar x
|
|
624
|
+
# # params[:zot] = "z" # --zot Z
|
|
625
|
+
#
|
|
612
626
|
def getopts: (*String options) -> Hash[String, untyped]
|
|
613
627
|
| (Array[String] args, *String options) -> Hash[String, untyped]
|
|
614
628
|
|
|
@@ -1099,7 +1113,7 @@ module OptionParser::Arguable
|
|
|
1099
1113
|
|
|
1100
1114
|
# <!--
|
|
1101
1115
|
# rdoc-file=lib/optparse.rb
|
|
1102
|
-
# - getopts(*args)
|
|
1116
|
+
# - getopts(*args, symbolize_names: false)
|
|
1103
1117
|
# -->
|
|
1104
1118
|
# Substitution of getopts is possible as follows. Also see OptionParser#getopts.
|
|
1105
1119
|
#
|
data/stdlib/pp/0/pp.rbs
CHANGED
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
# ## Output Customization
|
|
39
39
|
#
|
|
40
40
|
# To define a customized pretty printing function for your classes, redefine
|
|
41
|
-
# method `#pretty_print(pp)` in the class.
|
|
41
|
+
# method `#pretty_print(pp)` in the class. Note that `require 'pp'` is needed
|
|
42
|
+
# before redefining `#pretty_print(pp)`.
|
|
42
43
|
#
|
|
43
44
|
# `#pretty_print` takes the `pp` argument, which is an instance of the PP class.
|
|
44
45
|
# The method uses #text, #breakable, #nest, #group and #pp to print the object.
|
|
@@ -291,10 +292,6 @@ module Kernel
|
|
|
291
292
|
# -->
|
|
292
293
|
# Returns a pretty printed object as a string.
|
|
293
294
|
#
|
|
294
|
-
# In order to use this method you must first require the PP module:
|
|
295
|
-
#
|
|
296
|
-
# require 'pp'
|
|
297
|
-
#
|
|
298
295
|
# See the PP module for more information.
|
|
299
296
|
#
|
|
300
297
|
def pretty_inspect: () -> String
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
#
|
|
26
26
|
# ## References
|
|
27
27
|
# Christian Lindig, Strictly Pretty, March 2000,
|
|
28
|
-
#
|
|
28
|
+
# https://lindig.github.io/papers/strictly-pretty-2000.pdf
|
|
29
29
|
#
|
|
30
30
|
# Philip Wadler, A prettier printer, March 1998,
|
|
31
|
-
#
|
|
31
|
+
# https://homepages.inf.ed.ac.uk/wadler/topics/language-design.html#prettier
|
|
32
32
|
#
|
|
33
33
|
# ## Author
|
|
34
34
|
# Tanaka Akira <akr@fsij.org>
|
data/stdlib/pstore/0/pstore.rbs
CHANGED
|
@@ -352,8 +352,7 @@ class PStore
|
|
|
352
352
|
# - abort()
|
|
353
353
|
# -->
|
|
354
354
|
# Exits the current transaction block, discarding any changes specified in the
|
|
355
|
-
# transaction block.
|
|
356
|
-
# Aborting](rdoc-ref:PStore@Committing+or+Aborting).
|
|
355
|
+
# [transaction block](rdoc-ref:PStore@The+Transaction+Block).
|
|
357
356
|
#
|
|
358
357
|
# Raises an exception if called outside a transaction block.
|
|
359
358
|
#
|
|
@@ -364,8 +363,7 @@ class PStore
|
|
|
364
363
|
# - commit()
|
|
365
364
|
# -->
|
|
366
365
|
# Exits the current transaction block, committing any changes specified in the
|
|
367
|
-
# transaction block.
|
|
368
|
-
# Aborting](rdoc-ref:PStore@Committing+or+Aborting).
|
|
366
|
+
# [transaction block](rdoc-ref:PStore@The+Transaction+Block).
|
|
369
367
|
#
|
|
370
368
|
# Raises an exception if called outside a transaction block.
|
|
371
369
|
#
|
data/stdlib/rdoc/0/comment.rbs
CHANGED
|
@@ -7,8 +7,7 @@ module RDoc
|
|
|
7
7
|
# Each comment may have a different markup format set by #format=. By default
|
|
8
8
|
# 'rdoc' is used. The :markup: directive tells RDoc which format to use.
|
|
9
9
|
#
|
|
10
|
-
# See RDoc::
|
|
11
|
-
# format.
|
|
10
|
+
# See RDoc::MarkupReference@Directive+for+Specifying+RDoc+Source+Format.
|
|
12
11
|
#
|
|
13
12
|
class Comment
|
|
14
13
|
# <!-- rdoc-file=lib/rdoc/comment.rb -->
|
data/stdlib/resolv/0/resolv.rbs
CHANGED
|
@@ -128,7 +128,7 @@ class Resolv
|
|
|
128
128
|
|
|
129
129
|
# <!--
|
|
130
130
|
# rdoc-file=lib/resolv.rb
|
|
131
|
-
# - new(resolvers=
|
|
131
|
+
# - new(resolvers=nil, use_ipv6: nil)
|
|
132
132
|
# -->
|
|
133
133
|
# Creates a new Resolv using `resolvers`.
|
|
134
134
|
#
|
|
@@ -351,6 +351,8 @@ class Resolv::DNS
|
|
|
351
351
|
# : Must contain :nameserver, :search and :ndots keys.
|
|
352
352
|
#
|
|
353
353
|
# :nameserver_port can be used to specify port number of nameserver address.
|
|
354
|
+
# :raise_timeout_errors can be used to raise timeout errors as exceptions
|
|
355
|
+
# instead of treating the same as an NXDOMAIN response.
|
|
354
356
|
#
|
|
355
357
|
# The value of :nameserver should be an address string or an array of address
|
|
356
358
|
# strings.
|
|
@@ -921,7 +923,7 @@ end
|
|
|
921
923
|
# A generic resource abstract class.
|
|
922
924
|
#
|
|
923
925
|
class Resolv::DNS::Resource::Generic < Resolv::DNS::Resource
|
|
924
|
-
def self.create: (Integer type_value, Integer class_value) ->
|
|
926
|
+
def self.create: (Integer type_value, Integer class_value) -> Class
|
|
925
927
|
|
|
926
928
|
def self.decode_rdata: (Resolv::DNS::Message::MessageDecoder msg) -> instance
|
|
927
929
|
|
data/stdlib/socket/0/socket.rbs
CHANGED
|
@@ -1517,8 +1517,8 @@ Socket::AF_IMPLINK: Integer
|
|
|
1517
1517
|
#
|
|
1518
1518
|
Socket::AF_INET: Integer
|
|
1519
1519
|
|
|
1520
|
-
# <!-- rdoc-file=
|
|
1521
|
-
# IPv6 protocol
|
|
1520
|
+
# <!-- rdoc-file=lib/ipaddr.rb -->
|
|
1521
|
+
# IPv6 protocol family
|
|
1522
1522
|
#
|
|
1523
1523
|
Socket::AF_INET6: Integer
|
|
1524
1524
|
|
|
@@ -9,7 +9,7 @@ class UNIXSocket < BasicSocket
|
|
|
9
9
|
# -->
|
|
10
10
|
# Creates a pair of sockets connected to each other.
|
|
11
11
|
#
|
|
12
|
-
# *
|
|
12
|
+
# *type* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
|
|
13
13
|
#
|
|
14
14
|
# *protocol* should be a protocol defined in the domain. 0 is default protocol
|
|
15
15
|
# for the domain.
|
|
@@ -28,7 +28,7 @@ class UNIXSocket < BasicSocket
|
|
|
28
28
|
# -->
|
|
29
29
|
# Creates a pair of sockets connected to each other.
|
|
30
30
|
#
|
|
31
|
-
# *
|
|
31
|
+
# *type* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
|
|
32
32
|
#
|
|
33
33
|
# *protocol* should be a protocol defined in the domain. 0 is default protocol
|
|
34
34
|
# for the domain.
|
|
@@ -567,8 +567,9 @@ class StringScanner
|
|
|
567
567
|
# method is obsolete; use #eos? instead.
|
|
568
568
|
#
|
|
569
569
|
# s = StringScanner.new('test string')
|
|
570
|
-
#
|
|
571
|
-
# s.
|
|
570
|
+
# # These two are opposites
|
|
571
|
+
# s.eos? # => false
|
|
572
|
+
# s.rest? # => true
|
|
572
573
|
#
|
|
573
574
|
def rest?: () -> bool
|
|
574
575
|
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
# Note that Tempfile.create returns a File instance instead of a Tempfile, which
|
|
49
49
|
# also avoids the overhead and complications of delegation.
|
|
50
50
|
#
|
|
51
|
-
# Tempfile.
|
|
51
|
+
# Tempfile.create('foo') do |file|
|
|
52
52
|
# # ...do something with file...
|
|
53
53
|
# end
|
|
54
54
|
#
|