rbs 3.10.0.pre.2 → 3.10.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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/c-check.yml +1 -1
  3. data/.github/workflows/comments.yml +3 -3
  4. data/.github/workflows/ruby.yml +7 -8
  5. data/CHANGELOG.md +60 -0
  6. data/core/array.rbs +52 -3
  7. data/core/comparable.rbs +13 -6
  8. data/core/complex.rbs +40 -25
  9. data/core/dir.rbs +2 -2
  10. data/core/encoding.rbs +3 -7
  11. data/core/enumerable.rbs +1 -1
  12. data/core/enumerator.rbs +43 -1
  13. data/core/fiber.rbs +26 -17
  14. data/core/file.rbs +23 -8
  15. data/core/file_test.rbs +1 -1
  16. data/core/float.rbs +223 -32
  17. data/core/gc.rbs +4 -9
  18. data/core/hash.rbs +9 -10
  19. data/core/integer.rbs +104 -63
  20. data/core/io/buffer.rbs +21 -10
  21. data/core/io.rbs +8 -8
  22. data/core/kernel.rbs +12 -8
  23. data/core/method.rbs +49 -19
  24. data/core/module.rbs +30 -12
  25. data/core/numeric.rbs +17 -9
  26. data/core/object_space.rbs +13 -20
  27. data/core/pathname.rbs +2 -37
  28. data/core/proc.rbs +15 -16
  29. data/core/ractor.rbs +156 -145
  30. data/core/range.rbs +1 -1
  31. data/core/rational.rbs +56 -34
  32. data/core/rbs/unnamed/argf.rbs +1 -1
  33. data/core/regexp.rbs +3 -3
  34. data/core/ruby.rbs +53 -0
  35. data/core/rubygems/version.rbs +2 -3
  36. data/core/set.rbs +88 -66
  37. data/core/signal.rbs +24 -14
  38. data/core/string.rbs +304 -166
  39. data/core/symbol.rbs +13 -7
  40. data/core/thread.rbs +12 -13
  41. data/core/trace_point.rbs +7 -4
  42. data/lib/rbs/collection/config/lockfile_generator.rb +7 -0
  43. data/lib/rbs/environment_loader.rb +0 -6
  44. data/lib/rbs/subtractor.rb +3 -1
  45. data/lib/rbs/test/type_check.rb +1 -0
  46. data/lib/rbs/version.rb +1 -1
  47. data/lib/rdoc/discover.rb +1 -1
  48. data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
  49. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  50. data/stdlib/cgi/0/core.rbs +11 -1
  51. data/stdlib/cgi-escape/0/escape.rbs +33 -15
  52. data/stdlib/date/0/date.rbs +67 -59
  53. data/stdlib/date/0/date_time.rbs +1 -1
  54. data/stdlib/json/0/json.rbs +1 -0
  55. data/stdlib/objspace/0/objspace.rbs +1 -1
  56. data/stdlib/openssl/0/openssl.rbs +150 -80
  57. data/stdlib/pathname/0/pathname.rbs +36 -0
  58. data/stdlib/psych/0/psych.rbs +3 -3
  59. data/stdlib/stringio/0/stringio.rbs +796 -37
  60. data/stdlib/strscan/0/string_scanner.rbs +1 -1
  61. data/stdlib/tempfile/0/tempfile.rbs +2 -2
  62. data/stdlib/time/0/time.rbs +1 -1
  63. data/stdlib/timeout/0/timeout.rbs +63 -7
  64. data/stdlib/uri/0/generic.rbs +1 -1
  65. metadata +4 -2
@@ -35,6 +35,46 @@ module BigMath
35
35
  #
36
36
  def self?.PI: (Numeric prec) -> BigDecimal
37
37
 
38
+ # Computes the arccosine of `decimal` to the specified number of digits of
39
+ # precision, `numeric`.
40
+ #
41
+ # If `decimal` is NaN, returns NaN.
42
+ #
43
+ # BigMath.acos(BigDecimal('0.5'), 32).to_s
44
+ # #=> "0.10471975511965977461542144610932e1"
45
+ #
46
+ def self?.acos: (BigDecimal, Numeric) -> BigDecimal
47
+
48
+ # Computes the inverse hyperbolic cosine of `decimal` to the specified number of
49
+ # digits of precision, `numeric`.
50
+ #
51
+ # If `decimal` is NaN, returns NaN.
52
+ #
53
+ # BigMath.acosh(BigDecimal('2'), 32).to_s
54
+ # #=> "0.1316957896924816708625046347308e1"
55
+ #
56
+ def self?.acosh: (BigDecimal, Numeric) -> BigDecimal
57
+
58
+ # Computes the arcsine of `decimal` to the specified number of digits of
59
+ # precision, `numeric`.
60
+ #
61
+ # If `decimal` is NaN, returns NaN.
62
+ #
63
+ # BigMath.asin(BigDecimal('0.5'), 32).to_s
64
+ # #=> "0.52359877559829887307710723054658e0"
65
+ #
66
+ def self?.asin: (BigDecimal, Numeric) -> BigDecimal
67
+
68
+ # Computes the inverse hyperbolic sine of `decimal` to the specified number of
69
+ # digits of precision, `numeric`.
70
+ #
71
+ # If `decimal` is NaN, returns NaN.
72
+ #
73
+ # BigMath.asinh(BigDecimal('1'), 32).to_s
74
+ # #=> "0.88137358701954302523260932497979e0"
75
+ #
76
+ def self?.asinh: (BigDecimal, Numeric) -> BigDecimal
77
+
38
78
  # <!--
39
79
  # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
40
80
  # - atan(decimal, numeric) -> BigDecimal
@@ -49,6 +89,32 @@ module BigMath
49
89
  #
50
90
  def self?.atan: (BigDecimal x, Numeric prec) -> BigDecimal
51
91
 
92
+ # Computes the arctangent of y and x to the specified number of digits of
93
+ # precision, `numeric`.
94
+ #
95
+ # BigMath.atan2(BigDecimal('-1'), BigDecimal('1'), 32).to_s
96
+ # #=> "-0.78539816339744830961566084581988e0"
97
+ #
98
+ def self?.atan2: (BigDecimal, BigDecimal, Numeric) -> BigDecimal
99
+
100
+ # Computes the inverse hyperbolic tangent of `decimal` to the specified number
101
+ # of digits of precision, `numeric`.
102
+ #
103
+ # If `decimal` is NaN, returns NaN.
104
+ #
105
+ # BigMath.atanh(BigDecimal('0.5'), 32).to_s
106
+ # #=> "0.54930614433405484569762261846126e0"
107
+ #
108
+ def self?.atanh: (BigDecimal, Numeric) -> BigDecimal
109
+
110
+ # Computes the cube root of `decimal` to the specified number of digits of
111
+ # precision, `numeric`.
112
+ #
113
+ # BigMath.cbrt(BigDecimal('2'), 32).to_s
114
+ # #=> "0.12599210498948731647672106072782e1"
115
+ #
116
+ def self?.cbrt: (BigDecimal, Numeric) -> BigDecimal
117
+
52
118
  # <!--
53
119
  # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
54
120
  # - cos(decimal, numeric) -> BigDecimal
@@ -63,10 +129,36 @@ module BigMath
63
129
  #
64
130
  def self?.cos: (BigDecimal x, Numeric prec) -> BigDecimal
65
131
 
66
- # <!--
67
- # rdoc-file=ext/bigdecimal/bigdecimal.c
68
- # - BigMath.exp(decimal, numeric) -> BigDecimal
69
- # -->
132
+ # Computes the hyperbolic cosine of `decimal` to the specified number of digits
133
+ # of precision, `numeric`.
134
+ #
135
+ # If `decimal` is NaN, returns NaN.
136
+ #
137
+ # BigMath.cosh(BigDecimal('1'), 32).to_s
138
+ # #=> "0.15430806348152437784779056207571e1"
139
+ #
140
+ def self?.cosh: (BigDecimal, Numeric) -> BigDecimal
141
+
142
+ # Computes the error function of +decimal+ to the specified number of digits of
143
+ # precision, +numeric+.
144
+ #
145
+ # If +decimal+ is NaN, returns NaN.
146
+ #
147
+ # BigMath.erf(BigDecimal('1'), 32).to_s
148
+ # #=> "0.84270079294971486934122063508261e0"
149
+ #
150
+ def self?.erf: (BigDecimal, Numeric) -> BigDecimal
151
+
152
+ # Computes the complementary error function of +decimal+ to the specified number of digits of
153
+ # precision, +numeric+.
154
+ #
155
+ # If +decimal+ is NaN, returns NaN.
156
+ #
157
+ # BigMath.erfc(BigDecimal('10'), 32).to_s
158
+ # #=> "0.20884875837625447570007862949578e-44"
159
+ #
160
+ def self?.erfc: (BigDecimal, Numeric) -> BigDecimal
161
+
70
162
  # Computes the value of e (the base of natural logarithms) raised to the power
71
163
  # of `decimal`, to the specified number of digits of precision.
72
164
  #
@@ -76,10 +168,45 @@ module BigMath
76
168
  #
77
169
  def self?.exp: (BigDecimal, Numeric prec) -> BigDecimal
78
170
 
79
- # <!--
80
- # rdoc-file=ext/bigdecimal/bigdecimal.c
81
- # - BigMath.log(decimal, numeric) -> BigDecimal
82
- # -->
171
+ # Decomposes +x+ into a normalized fraction and an integral power of ten.
172
+ #
173
+ # BigMath.frexp(BigDecimal(123.456))
174
+ # #=> [0.123456e0, 3]
175
+ #
176
+ def self?.frexp: (BigDecimal) -> [ BigDecimal, Integer ]
177
+
178
+ # Computes the gamma function of +decimal+ to the specified number of
179
+ # digits of precision, +numeric+.
180
+ #
181
+ # BigMath.gamma(BigDecimal('0.5'), 32).to_s
182
+ # #=> "0.17724538509055160272981674833411e1"
183
+ #
184
+ def self?.gamma: (BigDecimal, Numeric) -> BigDecimal
185
+
186
+ # Returns sqrt(x**2 + y**2) to the specified number of digits of precision,
187
+ # `numeric`.
188
+ #
189
+ # BigMath.hypot(BigDecimal('1'), BigDecimal('2'), 32).to_s
190
+ # #=> "0.22360679774997896964091736687313e1"
191
+ #
192
+ def self?.hypot: (BigDecimal, BigDecimal, Numeric) -> BigDecimal
193
+
194
+ # Inverse of +frexp+.
195
+ # Returns the value of fraction * 10**exponent.
196
+ #
197
+ # BigMath.ldexp(BigDecimal("0.123456e0"), 3)
198
+ # #=> 0.123456e3
199
+ #
200
+ def self?.ldexp: (BigDecimal, Integer) -> BigDecimal
201
+
202
+ # Computes the natural logarithm of the absolute value of the gamma function
203
+ # of +decimal+ to the specified number of digits of precision, +numeric+ and its sign.
204
+ #
205
+ # BigMath.lgamma(BigDecimal('0.5'), 32)
206
+ # #=> [0.57236494292470008707171367567653e0, 1]
207
+ #
208
+ def self?.lgamma: (BigDecimal, Numeric) -> [BigDecimal, Integer]
209
+
83
210
  # Computes the natural logarithm of `decimal` to the specified number of digits
84
211
  # of precision, `numeric`.
85
212
  #
@@ -91,6 +218,20 @@ module BigMath
91
218
  #
92
219
  def self?.log: (BigDecimal, Numeric prec) -> BigDecimal
93
220
 
221
+ # Computes the base 2 logarithm of `decimal` to the specified number of digits
222
+ # of precision, `numeric`.
223
+ #
224
+ # If `decimal` is zero or negative, raises Math::DomainError.
225
+ #
226
+ # If `decimal` is positive infinity, returns Infinity.
227
+ #
228
+ # If `decimal` is NaN, returns NaN.
229
+ #
230
+ # BigMath.log2(BigDecimal('3'), 32).to_s
231
+ # #=> "0.15849625007211561814537389439478e1"
232
+ #
233
+ def self?.log2: (BigDecimal, Numeric) -> BigDecimal
234
+
94
235
  # <!--
95
236
  # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
96
237
  # - sin(decimal, numeric) -> BigDecimal
@@ -105,6 +246,16 @@ module BigMath
105
246
  #
106
247
  def self?.sin: (BigDecimal x, Numeric prec) -> BigDecimal
107
248
 
249
+ # Computes the hyperbolic sine of `decimal` to the specified number of digits of
250
+ # precision, `numeric`.
251
+ #
252
+ # If `decimal` is NaN, returns NaN.
253
+ #
254
+ # BigMath.sinh(BigDecimal('1'), 32).to_s
255
+ # #=> "0.11752011936438014568823818505956e1"
256
+ #
257
+ def self?.sinh: (BigDecimal, Numeric) -> BigDecimal
258
+
108
259
  # <!--
109
260
  # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
110
261
  # - sqrt(decimal, numeric) -> BigDecimal
@@ -116,4 +267,14 @@ module BigMath
116
267
  # #=> "0.1414213562373095048801688724e1"
117
268
  #
118
269
  def self?.sqrt: (BigDecimal x, Numeric prec) -> BigDecimal
270
+
271
+ # Computes the hyperbolic tangent of `decimal` to the specified number of digits
272
+ # of precision, `numeric`.
273
+ #
274
+ # If `decimal` is NaN, returns NaN.
275
+ #
276
+ # BigMath.tanh(BigDecimal('1'), 32).to_s
277
+ # #=> "0.76159415595576488811945828260479e0"
278
+ #
279
+ def self?.tanh: (BigDecimal, Numeric) -> BigDecimal
119
280
  end
@@ -1,5 +1,15 @@
1
1
  # <!-- rdoc-file=lib/cgi/escape.rb -->
2
- # :stopdoc
2
+ # Since Ruby 4.0, CGI is a small holder for various escaping methods, included
3
+ # from CGI::Escape
4
+ #
5
+ # require 'cgi/escape'
6
+ #
7
+ # CGI.escape("Ruby programming language")
8
+ # #=> "Ruby+programming+language"
9
+ # CGI.escapeURIComponent("Ruby programming language")
10
+ # #=> "Ruby%20programming%20language"
11
+ #
12
+ # See CGI::Escape module for methods list and their description.
3
13
  #
4
14
  class CGI
5
15
  include CGI::Util
@@ -1,5 +1,15 @@
1
1
  # <!-- rdoc-file=lib/cgi/escape.rb -->
2
- # :stopdoc
2
+ # Since Ruby 4.0, CGI is a small holder for various escaping methods, included
3
+ # from CGI::Escape
4
+ #
5
+ # require 'cgi/escape'
6
+ #
7
+ # CGI.escape("Ruby programming language")
8
+ # #=> "Ruby+programming+language"
9
+ # CGI.escapeURIComponent("Ruby programming language")
10
+ # #=> "Ruby%20programming%20language"
11
+ #
12
+ # See CGI::Escape module for methods list and their description.
3
13
  #
4
14
  class CGI
5
15
  include Escape
@@ -7,7 +17,7 @@ class CGI
7
17
  extend Escape
8
18
 
9
19
  # <!-- rdoc-file=lib/cgi/escape.rb -->
10
- # Escape/unescape for CGI, HTML, URI.
20
+ # Web-related escape/unescape functionality.
11
21
  #
12
22
  module Escape
13
23
  # <!--
@@ -15,7 +25,7 @@ class CGI
15
25
  # - escape(string)
16
26
  # -->
17
27
  # URL-encode a string into application/x-www-form-urlencoded. Space characters
18
- # (+" "+) are encoded with plus signs (+"+"+)
28
+ # (`" "`) are encoded with plus signs (`"+"`)
19
29
  # url_encoded_string = CGI.escape("'Stop!' said Fred")
20
30
  # # => "%27Stop%21%27+said+Fred"
21
31
  #
@@ -45,7 +55,7 @@ class CGI
45
55
  # rdoc-file=lib/cgi/escape.rb
46
56
  # - escapeHTML(string)
47
57
  # -->
48
- # Escape special characters in HTML, namely '&"<>
58
+ # Escape special characters in HTML, namely `'&\"<>`
49
59
  # CGI.escapeHTML('Usage: foo "bar" <baz>')
50
60
  # # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
51
61
  #
@@ -55,20 +65,24 @@ class CGI
55
65
  # rdoc-file=lib/cgi/escape.rb
56
66
  # - escapeURIComponent(string)
57
67
  # -->
58
- # URL-encode a string following RFC 3986 Space characters (+" "+) are encoded
59
- # with (+"%20"+)
68
+ # URL-encode a string following RFC 3986 Space characters (`" "`) are encoded
69
+ # with (`"%20"`)
60
70
  # url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
61
71
  # # => "%27Stop%21%27%20said%20Fred"
62
72
  #
63
73
  def escapeURIComponent: (string) -> String
64
74
 
65
- # <!-- rdoc-file=lib/cgi/escape.rb -->
66
- # Synonym for CGI.escapeElement(str)
75
+ # <!--
76
+ # rdoc-file=lib/cgi/escape.rb
77
+ # - escape_element(string, *elements)
78
+ # -->
67
79
  #
68
80
  alias escape_element escapeElement
69
81
 
70
- # <!-- rdoc-file=lib/cgi/escape.rb -->
71
- # Synonym for CGI.escapeHTML(str)
82
+ # <!--
83
+ # rdoc-file=lib/cgi/escape.rb
84
+ # - escape_html(string)
85
+ # -->
72
86
  #
73
87
  alias escape_html escapeHTML
74
88
 
@@ -101,7 +115,7 @@ class CGI
101
115
  # rdoc-file=lib/cgi/escape.rb
102
116
  # - unescapeElement(string, *elements)
103
117
  # -->
104
- # Undo escaping such as that done by CGI.escapeElement()
118
+ # Undo escaping such as that done by CGI.escapeElement
105
119
  #
106
120
  # print CGI.unescapeElement(
107
121
  # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
@@ -133,13 +147,17 @@ class CGI
133
147
  #
134
148
  def unescapeURIComponent: (string) -> String
135
149
 
136
- # <!-- rdoc-file=lib/cgi/escape.rb -->
137
- # Synonym for CGI.unescapeElement(str)
150
+ # <!--
151
+ # rdoc-file=lib/cgi/escape.rb
152
+ # - unescape_element(string, *elements)
153
+ # -->
138
154
  #
139
155
  alias unescape_element unescapeElement
140
156
 
141
- # <!-- rdoc-file=lib/cgi/escape.rb -->
142
- # Synonym for CGI.unescapeHTML(str)
157
+ # <!--
158
+ # rdoc-file=lib/cgi/escape.rb
159
+ # - unescape_html(string)
160
+ # -->
143
161
  #
144
162
  alias unescape_html unescapeHTML
145
163