rbs 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- data/lib/rbs/location.rb +0 -221
@@ -1,3 +1,4 @@
|
|
1
|
+
# <!-- rdoc-file=lib/shellwords.rb -->
|
1
2
|
# ## Manipulates strings like the UNIX Bourne shell
|
2
3
|
#
|
3
4
|
# This module manipulates strings according to the word parsing rules of the
|
@@ -67,7 +68,12 @@
|
|
67
68
|
# 1: [IEEE Std 1003.1-2008, 2016 Edition, the Shell & Utilities
|
68
69
|
# volume](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.htm
|
69
70
|
# l)
|
71
|
+
#
|
70
72
|
module Shellwords
|
73
|
+
# <!--
|
74
|
+
# rdoc-file=lib/shellwords.rb
|
75
|
+
# - shellescape(str)
|
76
|
+
# -->
|
71
77
|
# Escapes a string so that it can be safely used in a Bourne shell command line.
|
72
78
|
# `str` can be a non-string object that responds to `to_s`.
|
73
79
|
#
|
@@ -98,8 +104,12 @@ module Shellwords
|
|
98
104
|
#
|
99
105
|
# Returns an empty quoted String if `str` has a length of zero.
|
100
106
|
#
|
101
|
-
def self
|
107
|
+
def self?.shellescape: (String str) -> String
|
102
108
|
|
109
|
+
# <!--
|
110
|
+
# rdoc-file=lib/shellwords.rb
|
111
|
+
# - shelljoin(array)
|
112
|
+
# -->
|
103
113
|
# Builds a command line string from an argument list, `array`.
|
104
114
|
#
|
105
115
|
# All elements are joined into a single string with fields separated by a space,
|
@@ -120,8 +130,12 @@ module Shellwords
|
|
120
130
|
#
|
121
131
|
# output = `#{['ps', '-p', $$].shelljoin}`
|
122
132
|
#
|
123
|
-
def self
|
133
|
+
def self?.shelljoin: (Array[String] array) -> String
|
124
134
|
|
135
|
+
# <!--
|
136
|
+
# rdoc-file=lib/shellwords.rb
|
137
|
+
# - shellsplit(line)
|
138
|
+
# -->
|
125
139
|
# Splits a string into an array of tokens in the same way the UNIX Bourne shell
|
126
140
|
# does.
|
127
141
|
#
|
@@ -139,95 +153,50 @@ module Shellwords
|
|
139
153
|
# argv = 'here are "two words"'.shellsplit
|
140
154
|
# argv #=> ["here", "are", "two words"]
|
141
155
|
#
|
142
|
-
def self
|
156
|
+
def self?.shellsplit: (String line) -> Array[String]
|
143
157
|
|
158
|
+
# <!--
|
159
|
+
# rdoc-file=lib/shellwords.rb
|
160
|
+
# - escape(str)
|
161
|
+
# -->
|
162
|
+
#
|
144
163
|
alias self.escape self.shellescape
|
145
164
|
|
165
|
+
# <!--
|
166
|
+
# rdoc-file=lib/shellwords.rb
|
167
|
+
# - join(array)
|
168
|
+
# -->
|
169
|
+
#
|
146
170
|
alias self.join self.shelljoin
|
147
171
|
|
172
|
+
# <!--
|
173
|
+
# rdoc-file=lib/shellwords.rb
|
174
|
+
# - shellwords(line)
|
175
|
+
# -->
|
176
|
+
#
|
148
177
|
alias self.shellwords self.shellsplit
|
149
178
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
# Escapes a string so that it can be safely used in a Bourne shell command line.
|
155
|
-
# `str` can be a non-string object that responds to `to_s`.
|
156
|
-
#
|
157
|
-
# Note that a resulted string should be used unquoted and is not intended for
|
158
|
-
# use in double quotes nor in single quotes.
|
159
|
-
#
|
160
|
-
# argv = Shellwords.escape("It's better to give than to receive")
|
161
|
-
# argv #=> "It\\'s\\ better\\ to\\ give\\ than\\ to\\ receive"
|
162
|
-
#
|
163
|
-
# String#shellescape is a shorthand for this function.
|
164
|
-
#
|
165
|
-
# argv = "It's better to give than to receive".shellescape
|
166
|
-
# argv #=> "It\\'s\\ better\\ to\\ give\\ than\\ to\\ receive"
|
167
|
-
#
|
168
|
-
# # Search files in lib for method definitions
|
169
|
-
# pattern = "^[ \t]*def "
|
170
|
-
# open("| grep -Ern -e #{pattern.shellescape} lib") { |grep|
|
171
|
-
# grep.each_line { |line|
|
172
|
-
# file, lineno, matched_line = line.split(':', 3)
|
173
|
-
# # ...
|
174
|
-
# }
|
175
|
-
# }
|
179
|
+
# <!--
|
180
|
+
# rdoc-file=lib/shellwords.rb
|
181
|
+
# - split(line)
|
182
|
+
# -->
|
176
183
|
#
|
177
|
-
|
178
|
-
# for the shell environment where this string is used.
|
179
|
-
#
|
180
|
-
# Multibyte characters are treated as multibyte characters, not as bytes.
|
181
|
-
#
|
182
|
-
# Returns an empty quoted String if `str` has a length of zero.
|
183
|
-
#
|
184
|
-
def shellescape: (String str) -> String
|
185
|
-
|
186
|
-
# Builds a command line string from an argument list, `array`.
|
187
|
-
#
|
188
|
-
# All elements are joined into a single string with fields separated by a space,
|
189
|
-
# where each element is escaped for the Bourne shell and stringified using
|
190
|
-
# `to_s`.
|
191
|
-
#
|
192
|
-
# ary = ["There's", "a", "time", "and", "place", "for", "everything"]
|
193
|
-
# argv = Shellwords.join(ary)
|
194
|
-
# argv #=> "There\\'s a time and place for everything"
|
195
|
-
#
|
196
|
-
# Array#shelljoin is a shortcut for this function.
|
197
|
-
#
|
198
|
-
# ary = ["Don't", "rock", "the", "boat"]
|
199
|
-
# argv = ary.shelljoin
|
200
|
-
# argv #=> "Don\\'t rock the boat"
|
201
|
-
#
|
202
|
-
# You can also mix non-string objects in the elements as allowed in Array#join.
|
203
|
-
#
|
204
|
-
# output = `#{['ps', '-p', $$].shelljoin}`
|
205
|
-
#
|
206
|
-
def shelljoin: (Array[String] array) -> String
|
184
|
+
alias self.split self.shellsplit
|
207
185
|
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
# argv #=> ["here", "are", "two words"]
|
213
|
-
#
|
214
|
-
# Note, however, that this is not a command line parser. Shell metacharacters
|
215
|
-
# except for the single and double quotes and backslash are not treated as such.
|
186
|
+
# <!--
|
187
|
+
# rdoc-file=lib/shellwords.rb
|
188
|
+
# - shellwords(line)
|
189
|
+
# -->
|
216
190
|
#
|
217
|
-
# argv = Shellwords.split('ruby my_prog.rb | less')
|
218
|
-
# argv #=> ["ruby", "my_prog.rb", "|", "less"]
|
219
|
-
#
|
220
|
-
# String#shellsplit is a shortcut for this function.
|
221
|
-
#
|
222
|
-
# argv = 'here are "two words"'.shellsplit
|
223
|
-
# argv #=> ["here", "are", "two words"]
|
224
|
-
#
|
225
|
-
def shellsplit: (String line) -> Array[String]
|
226
|
-
|
227
191
|
alias shellwords shellsplit
|
228
192
|
end
|
229
193
|
|
194
|
+
%a{annotate:rdoc:skip}
|
230
195
|
class Array[unchecked out Elem]
|
196
|
+
# <!--
|
197
|
+
# rdoc-file=lib/shellwords.rb
|
198
|
+
# - array.shelljoin => string
|
199
|
+
# -->
|
231
200
|
# Builds a command line string from an argument list `array` joining all
|
232
201
|
# elements escaped for the Bourne shell and separated by a space.
|
233
202
|
#
|
@@ -236,13 +205,22 @@ class Array[unchecked out Elem]
|
|
236
205
|
def shelljoin: () -> String
|
237
206
|
end
|
238
207
|
|
208
|
+
%a{annotate:rdoc:skip}
|
239
209
|
class String
|
210
|
+
# <!--
|
211
|
+
# rdoc-file=lib/shellwords.rb
|
212
|
+
# - str.shellescape => string
|
213
|
+
# -->
|
240
214
|
# Escapes `str` so that it can be safely used in a Bourne shell command line.
|
241
215
|
#
|
242
216
|
# See Shellwords.shellescape for details.
|
243
217
|
#
|
244
218
|
def shellescape: () -> String
|
245
219
|
|
220
|
+
# <!--
|
221
|
+
# rdoc-file=lib/shellwords.rb
|
222
|
+
# - str.shellsplit => array
|
223
|
+
# -->
|
246
224
|
# Splits `str` into an array of tokens in the same way the UNIX Bourne shell
|
247
225
|
# does.
|
248
226
|
#
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# <!-- rdoc-file=lib/singleton.rb -->
|
1
2
|
# The Singleton module implements the Singleton pattern.
|
2
3
|
#
|
3
4
|
# ## Usage
|
@@ -88,21 +89,40 @@
|
|
88
89
|
# p a == b # => true
|
89
90
|
# p a.keep # => "keep this"
|
90
91
|
# p a.strip # => nil
|
92
|
+
#
|
91
93
|
module Singleton
|
92
94
|
def self.__init__: (Class klass) -> Class
|
93
95
|
|
96
|
+
# <!--
|
97
|
+
# rdoc-file=lib/singleton.rb
|
98
|
+
# - instance()
|
99
|
+
# -->
|
100
|
+
# Returns the singleton instance.
|
101
|
+
#
|
94
102
|
def self.instance: () -> instance
|
95
103
|
|
96
104
|
public
|
97
105
|
|
106
|
+
# <!--
|
107
|
+
# rdoc-file=lib/singleton.rb
|
108
|
+
# - _dump(depth = -1)
|
109
|
+
# -->
|
98
110
|
# By default, do not retain any state when marshalling.
|
99
111
|
#
|
100
112
|
def _dump: (?Integer depth) -> String
|
101
113
|
|
114
|
+
# <!--
|
115
|
+
# rdoc-file=lib/singleton.rb
|
116
|
+
# - clone()
|
117
|
+
# -->
|
102
118
|
# Raises a TypeError to prevent cloning.
|
103
119
|
#
|
104
120
|
def clone: () -> bot
|
105
121
|
|
122
|
+
# <!--
|
123
|
+
# rdoc-file=lib/singleton.rb
|
124
|
+
# - dup()
|
125
|
+
# -->
|
106
126
|
# Raises a TypeError to prevent duping.
|
107
127
|
#
|
108
128
|
def dup: () -> bot
|