rbs 3.9.5 → 3.10.0.pre.1
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/.clang-format +74 -0
- data/.clangd +2 -0
- data/.github/workflows/c-check.yml +54 -0
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +34 -19
- data/.github/workflows/typecheck.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/.gitignore +4 -0
- data/README.md +38 -1
- data/Rakefile +152 -23
- data/config.yml +190 -62
- data/core/array.rbs +44 -43
- data/core/dir.rbs +2 -2
- data/core/encoding.rbs +3 -2
- data/core/enumerable.rbs +89 -2
- data/core/errno.rbs +8 -0
- data/core/errors.rbs +28 -1
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +3 -3
- data/core/file.rbs +26 -11
- data/core/float.rbs +1 -1
- data/core/gc.rbs +422 -281
- data/core/hash.rbs +1024 -727
- data/core/io/wait.rbs +11 -33
- data/core/io.rbs +6 -4
- data/core/kernel.rbs +49 -43
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +42 -3
- data/core/method.rbs +14 -6
- data/core/module.rbs +71 -11
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +8 -8
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +13 -0
- data/{stdlib/pathname/0 → core}/pathname.rbs +253 -352
- data/core/proc.rbs +15 -8
- data/core/process.rbs +2 -2
- data/core/ractor.rbs +278 -437
- data/core/range.rbs +6 -7
- data/core/rbs/unnamed/argf.rbs +1 -1
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +4 -2
- data/core/regexp.rbs +22 -17
- data/core/ruby_vm.rbs +6 -4
- data/core/rubygems/errors.rbs +3 -70
- data/core/rubygems/rubygems.rbs +11 -79
- data/core/set.rbs +439 -332
- data/core/string.rbs +2897 -1117
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +4 -4
- data/core/thread.rbs +83 -20
- data/core/time.rbs +35 -9
- data/core/unbound_method.rbs +14 -6
- data/docs/aliases.md +79 -0
- data/docs/collection.md +2 -2
- data/docs/gem.md +0 -1
- data/docs/sigs.md +3 -3
- data/ext/rbs_extension/ast_translation.c +1016 -0
- data/ext/rbs_extension/ast_translation.h +37 -0
- data/ext/rbs_extension/class_constants.c +157 -0
- data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
- data/ext/rbs_extension/compat.h +10 -0
- data/ext/rbs_extension/extconf.rb +25 -1
- data/ext/rbs_extension/legacy_location.c +317 -0
- data/ext/rbs_extension/legacy_location.h +45 -0
- data/ext/rbs_extension/main.c +365 -14
- data/ext/rbs_extension/rbs_extension.h +6 -21
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +24 -0
- data/include/rbs/ast.h +687 -0
- data/include/rbs/defines.h +86 -0
- data/include/rbs/lexer.h +199 -0
- data/include/rbs/location.h +59 -0
- data/include/rbs/parser.h +135 -0
- data/include/rbs/string.h +49 -0
- data/include/rbs/util/rbs_allocator.h +59 -0
- data/include/rbs/util/rbs_assert.h +20 -0
- data/include/rbs/util/rbs_buffer.h +83 -0
- data/include/rbs/util/rbs_constant_pool.h +6 -67
- data/include/rbs/util/rbs_encoding.h +282 -0
- data/include/rbs/util/rbs_unescape.h +23 -0
- data/include/rbs.h +1 -2
- data/lib/rbs/annotate/formatter.rb +3 -13
- data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
- data/lib/rbs/annotate/rdoc_source.rb +1 -1
- data/lib/rbs/cli/validate.rb +2 -2
- data/lib/rbs/cli.rb +1 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +1 -0
- data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
- data/lib/rbs/environment.rb +64 -59
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/errors.rb +1 -1
- data/lib/rbs/parser_aux.rb +5 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +124 -38
- data/lib/rbs/test/type_check.rb +13 -0
- data/lib/rbs/types.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +3 -3
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/environment.rbs +57 -6
- data/sig/manifest.yaml +0 -1
- data/sig/parser.rbs +20 -0
- data/sig/resolver/type_name_resolver.rbs +38 -7
- data/sig/types.rbs +4 -1
- data/src/ast.c +1256 -0
- data/src/lexer.c +2956 -0
- data/src/lexer.re +147 -0
- data/src/lexstate.c +205 -0
- data/src/location.c +71 -0
- data/src/parser.c +3495 -0
- data/src/string.c +90 -0
- data/src/util/rbs_allocator.c +152 -0
- data/src/util/rbs_assert.c +21 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +16 -86
- data/src/util/rbs_encoding.c +21308 -0
- data/src/util/rbs_unescape.c +131 -0
- data/stdlib/cgi/0/core.rbs +2 -396
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +153 -0
- data/stdlib/coverage/0/coverage.rbs +3 -1
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/erb/0/erb.rbs +737 -347
- data/stdlib/fileutils/0/fileutils.rbs +18 -13
- data/stdlib/forwardable/0/forwardable.rbs +3 -0
- data/stdlib/json/0/json.rbs +67 -48
- data/stdlib/net-http/0/net-http.rbs +3 -0
- data/stdlib/objspace/0/objspace.rbs +8 -3
- data/stdlib/open-uri/0/open-uri.rbs +40 -0
- data/stdlib/openssl/0/openssl.rbs +182 -149
- data/stdlib/optparse/0/optparse.rbs +3 -3
- data/stdlib/rdoc/0/code_object.rbs +2 -2
- data/stdlib/rdoc/0/comment.rbs +2 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/rdoc.rbs +7 -5
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +5 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/socket.rbs +13 -1
- data/stdlib/socket/0/tcp_socket.rbs +10 -2
- data/stdlib/stringio/0/stringio.rbs +412 -80
- data/stdlib/strscan/0/string_scanner.rbs +31 -31
- data/stdlib/tempfile/0/tempfile.rbs +1 -1
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/uri/0/common.rbs +11 -2
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +16 -15
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +41 -18
- data/ext/rbs_extension/lexer.c +0 -2728
- data/ext/rbs_extension/lexer.h +0 -179
- data/ext/rbs_extension/lexer.re +0 -147
- data/ext/rbs_extension/lexstate.c +0 -175
- data/ext/rbs_extension/location.c +0 -325
- data/ext/rbs_extension/location.h +0 -85
- data/ext/rbs_extension/parser.c +0 -2982
- data/ext/rbs_extension/parser.h +0 -18
- data/ext/rbs_extension/parserstate.c +0 -411
- data/ext/rbs_extension/parserstate.h +0 -163
- data/ext/rbs_extension/unescape.c +0 -32
- data/include/rbs/ruby_objs.h +0 -72
- data/src/constants.c +0 -153
- data/src/ruby_objs.c +0 -799
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/cgi/escape.rb -->
|
|
2
|
+
# :stopdoc
|
|
3
|
+
#
|
|
4
|
+
class CGI
|
|
5
|
+
include Escape
|
|
6
|
+
|
|
7
|
+
extend Escape
|
|
8
|
+
|
|
9
|
+
# <!-- rdoc-file=lib/cgi/escape.rb -->
|
|
10
|
+
# Escape/unescape for CGI, HTML, URI.
|
|
11
|
+
#
|
|
12
|
+
module Escape
|
|
13
|
+
# <!--
|
|
14
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
15
|
+
# - escape(string)
|
|
16
|
+
# -->
|
|
17
|
+
# URL-encode a string into application/x-www-form-urlencoded. Space characters
|
|
18
|
+
# (+" "+) are encoded with plus signs (+"+"+)
|
|
19
|
+
# url_encoded_string = CGI.escape("'Stop!' said Fred")
|
|
20
|
+
# # => "%27Stop%21%27+said+Fred"
|
|
21
|
+
#
|
|
22
|
+
def escape: (string str) -> String
|
|
23
|
+
|
|
24
|
+
# <!--
|
|
25
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
26
|
+
# - escapeElement(string, *elements)
|
|
27
|
+
# -->
|
|
28
|
+
# Escape only the tags of certain HTML elements in `string`.
|
|
29
|
+
#
|
|
30
|
+
# Takes an element or elements or array of elements. Each element is specified
|
|
31
|
+
# by the name of the element, without angle brackets. This matches both the
|
|
32
|
+
# start and the end tag of that element. The attribute list of the open tag will
|
|
33
|
+
# also be escaped (for instance, the double-quotes surrounding attribute
|
|
34
|
+
# values).
|
|
35
|
+
#
|
|
36
|
+
# print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
|
|
37
|
+
# # "<BR><A HREF="url"></A>"
|
|
38
|
+
#
|
|
39
|
+
# print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
|
|
40
|
+
# # "<BR><A HREF="url"></A>"
|
|
41
|
+
#
|
|
42
|
+
def escapeElement: (string string, *String | Array[String] elements) -> String
|
|
43
|
+
|
|
44
|
+
# <!--
|
|
45
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
46
|
+
# - escapeHTML(string)
|
|
47
|
+
# -->
|
|
48
|
+
# Escape special characters in HTML, namely '&"<>
|
|
49
|
+
# CGI.escapeHTML('Usage: foo "bar" <baz>')
|
|
50
|
+
# # => "Usage: foo "bar" <baz>"
|
|
51
|
+
#
|
|
52
|
+
def escapeHTML: (string str) -> String
|
|
53
|
+
|
|
54
|
+
# <!--
|
|
55
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
56
|
+
# - escapeURIComponent(string)
|
|
57
|
+
# -->
|
|
58
|
+
# URL-encode a string following RFC 3986 Space characters (+" "+) are encoded
|
|
59
|
+
# with (+"%20"+)
|
|
60
|
+
# url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
|
|
61
|
+
# # => "%27Stop%21%27%20said%20Fred"
|
|
62
|
+
#
|
|
63
|
+
def escapeURIComponent: (string) -> String
|
|
64
|
+
|
|
65
|
+
# <!-- rdoc-file=lib/cgi/escape.rb -->
|
|
66
|
+
# Synonym for CGI.escapeElement(str)
|
|
67
|
+
#
|
|
68
|
+
alias escape_element escapeElement
|
|
69
|
+
|
|
70
|
+
# <!-- rdoc-file=lib/cgi/escape.rb -->
|
|
71
|
+
# Synonym for CGI.escapeHTML(str)
|
|
72
|
+
#
|
|
73
|
+
alias escape_html escapeHTML
|
|
74
|
+
|
|
75
|
+
# <!--
|
|
76
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
77
|
+
# - escape_uri_component(string)
|
|
78
|
+
# -->
|
|
79
|
+
#
|
|
80
|
+
alias escape_uri_component escapeURIComponent
|
|
81
|
+
|
|
82
|
+
# <!--
|
|
83
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
84
|
+
# - h(string)
|
|
85
|
+
# -->
|
|
86
|
+
#
|
|
87
|
+
alias h escapeHTML
|
|
88
|
+
|
|
89
|
+
# <!--
|
|
90
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
91
|
+
# - unescape(string, encoding = @@accept_charset)
|
|
92
|
+
# -->
|
|
93
|
+
# URL-decode an application/x-www-form-urlencoded string with
|
|
94
|
+
# encoding(optional).
|
|
95
|
+
# string = CGI.unescape("%27Stop%21%27+said+Fred")
|
|
96
|
+
# # => "'Stop!' said Fred"
|
|
97
|
+
#
|
|
98
|
+
def unescape: (string str, ?encoding encoding) -> String
|
|
99
|
+
|
|
100
|
+
# <!--
|
|
101
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
102
|
+
# - unescapeElement(string, *elements)
|
|
103
|
+
# -->
|
|
104
|
+
# Undo escaping such as that done by CGI.escapeElement()
|
|
105
|
+
#
|
|
106
|
+
# print CGI.unescapeElement(
|
|
107
|
+
# CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
|
|
108
|
+
# # "<BR><A HREF="url"></A>"
|
|
109
|
+
#
|
|
110
|
+
# print CGI.unescapeElement(
|
|
111
|
+
# CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
|
|
112
|
+
# # "<BR><A HREF="url"></A>"
|
|
113
|
+
#
|
|
114
|
+
def unescapeElement: (string string, *String | Array[String] elements) -> String
|
|
115
|
+
|
|
116
|
+
# <!--
|
|
117
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
118
|
+
# - unescapeHTML(string)
|
|
119
|
+
# -->
|
|
120
|
+
# Unescape a string that has been HTML-escaped
|
|
121
|
+
# CGI.unescapeHTML("Usage: foo "bar" <baz>")
|
|
122
|
+
# # => "Usage: foo \"bar\" <baz>"
|
|
123
|
+
#
|
|
124
|
+
def unescapeHTML: (string str) -> String
|
|
125
|
+
|
|
126
|
+
# <!--
|
|
127
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
128
|
+
# - unescapeURIComponent(string, encoding = @@accept_charset)
|
|
129
|
+
# -->
|
|
130
|
+
# URL-decode a string following RFC 3986 with encoding(optional).
|
|
131
|
+
# string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred")
|
|
132
|
+
# # => "'Stop!'+said Fred"
|
|
133
|
+
#
|
|
134
|
+
def unescapeURIComponent: (string) -> String
|
|
135
|
+
|
|
136
|
+
# <!-- rdoc-file=lib/cgi/escape.rb -->
|
|
137
|
+
# Synonym for CGI.unescapeElement(str)
|
|
138
|
+
#
|
|
139
|
+
alias unescape_element unescapeElement
|
|
140
|
+
|
|
141
|
+
# <!-- rdoc-file=lib/cgi/escape.rb -->
|
|
142
|
+
# Synonym for CGI.unescapeHTML(str)
|
|
143
|
+
#
|
|
144
|
+
alias unescape_html unescapeHTML
|
|
145
|
+
|
|
146
|
+
# <!--
|
|
147
|
+
# rdoc-file=lib/cgi/escape.rb
|
|
148
|
+
# - unescape_uri_component(string, encoding = @@accept_charset)
|
|
149
|
+
# -->
|
|
150
|
+
#
|
|
151
|
+
alias unescape_uri_component unescapeURIComponent
|
|
152
|
+
end
|
|
153
|
+
end
|
|
@@ -147,8 +147,10 @@
|
|
|
147
147
|
module Coverage
|
|
148
148
|
# <!--
|
|
149
149
|
# rdoc-file=ext/coverage/lib/coverage.rb
|
|
150
|
-
# - line_stub(file)
|
|
150
|
+
# - line_stub(file) -> array
|
|
151
151
|
# -->
|
|
152
|
+
# A simple helper function that creates the "stub" of line coverage from a given
|
|
153
|
+
# source code.
|
|
152
154
|
#
|
|
153
155
|
def self.line_stub: (String) -> Array[Integer?]
|
|
154
156
|
|
|
@@ -44,7 +44,7 @@ class Delegator < BasicObject
|
|
|
44
44
|
# rdoc-file=lib/delegate.rb
|
|
45
45
|
# - !()
|
|
46
46
|
# -->
|
|
47
|
-
# Delegates ! to the
|
|
47
|
+
# Delegates ! to the `__getobj__`
|
|
48
48
|
#
|
|
49
49
|
def !: () -> untyped
|
|
50
50
|
|
|
@@ -94,7 +94,7 @@ class Delegator < BasicObject
|
|
|
94
94
|
# rdoc-file=lib/delegate.rb
|
|
95
95
|
# - freeze()
|
|
96
96
|
# -->
|
|
97
|
-
# :method: freeze Freeze both the object returned by
|
|
97
|
+
# :method: freeze Freeze both the object returned by `__getobj__` and self.
|
|
98
98
|
#
|
|
99
99
|
def freeze: () -> self
|
|
100
100
|
|
|
@@ -102,7 +102,7 @@ class Delegator < BasicObject
|
|
|
102
102
|
# rdoc-file=lib/delegate.rb
|
|
103
103
|
# - marshal_dump()
|
|
104
104
|
# -->
|
|
105
|
-
# Serialization support for the object returned by
|
|
105
|
+
# Serialization support for the object returned by `__getobj__`.
|
|
106
106
|
#
|
|
107
107
|
def marshal_dump: () -> untyped
|
|
108
108
|
|
|
@@ -126,7 +126,7 @@ class Delegator < BasicObject
|
|
|
126
126
|
# - methods(all=true)
|
|
127
127
|
# -->
|
|
128
128
|
# Returns the methods available to this delegate object as the union of this
|
|
129
|
-
# object's and
|
|
129
|
+
# object's and `__getobj__` methods.
|
|
130
130
|
#
|
|
131
131
|
def methods: (?boolish all) -> Array[Symbol]
|
|
132
132
|
|
|
@@ -135,7 +135,7 @@ class Delegator < BasicObject
|
|
|
135
135
|
# - protected_methods(all=true)
|
|
136
136
|
# -->
|
|
137
137
|
# Returns the methods available to this delegate object as the union of this
|
|
138
|
-
# object's and
|
|
138
|
+
# object's and `__getobj__` protected methods.
|
|
139
139
|
#
|
|
140
140
|
def protected_methods: (?boolish all) -> Array[Symbol]
|
|
141
141
|
|
|
@@ -144,7 +144,7 @@ class Delegator < BasicObject
|
|
|
144
144
|
# - public_methods(all=true)
|
|
145
145
|
# -->
|
|
146
146
|
# Returns the methods available to this delegate object as the union of this
|
|
147
|
-
# object's and
|
|
147
|
+
# object's and `__getobj__` public methods.
|
|
148
148
|
#
|
|
149
149
|
def public_methods: (?untyped all) -> Array[Symbol]
|
|
150
150
|
|
|
@@ -168,7 +168,7 @@ class Delegator < BasicObject
|
|
|
168
168
|
# - respond_to_missing?(m, include_private)
|
|
169
169
|
# -->
|
|
170
170
|
# Checks for a method provided by this the delegate object by forwarding the
|
|
171
|
-
# call through
|
|
171
|
+
# call through `__getobj__`.
|
|
172
172
|
#
|
|
173
173
|
def respond_to_missing?: (Symbol m, bool include_private) -> bool
|
|
174
174
|
|
|
@@ -180,5 +180,8 @@ class Delegator < BasicObject
|
|
|
180
180
|
#
|
|
181
181
|
def target_respond_to?: (untyped target, Symbol m, bool include_private) -> bool
|
|
182
182
|
|
|
183
|
+
# <!-- rdoc-file=lib/delegate.rb -->
|
|
184
|
+
# The version string
|
|
185
|
+
#
|
|
183
186
|
VERSION: String
|
|
184
187
|
end
|