rbs 3.10.0.pre.2 → 3.10.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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/c-check.yml +1 -1
  3. data/.github/workflows/comments.yml +2 -2
  4. data/.github/workflows/ruby.yml +7 -7
  5. data/CHANGELOG.md +49 -0
  6. data/core/array.rbs +56 -3
  7. data/core/complex.rbs +32 -21
  8. data/core/encoding.rbs +3 -7
  9. data/core/enumerable.rbs +1 -1
  10. data/core/enumerator.rbs +18 -1
  11. data/core/fiber.rbs +2 -1
  12. data/core/file.rbs +1 -1
  13. data/core/file_test.rbs +1 -1
  14. data/core/float.rbs +208 -21
  15. data/core/gc.rbs +4 -9
  16. data/core/hash.rbs +4 -4
  17. data/core/integer.rbs +78 -38
  18. data/core/io/buffer.rbs +18 -7
  19. data/core/io.rbs +8 -8
  20. data/core/kernel.rbs +8 -8
  21. data/core/module.rbs +17 -6
  22. data/core/numeric.rbs +8 -8
  23. data/core/object_space.rbs +13 -20
  24. data/core/pathname.rbs +2 -3
  25. data/core/ractor.rbs +4 -4
  26. data/core/range.rbs +1 -1
  27. data/core/rational.rbs +37 -24
  28. data/core/rbs/unnamed/argf.rbs +1 -1
  29. data/core/regexp.rbs +3 -3
  30. data/core/ruby.rbs +53 -0
  31. data/core/rubygems/version.rbs +2 -3
  32. data/core/set.rbs +86 -64
  33. data/core/string.rbs +275 -141
  34. data/core/thread.rbs +9 -9
  35. data/core/trace_point.rbs +7 -4
  36. data/lib/rbs/test/type_check.rb +1 -0
  37. data/lib/rbs/version.rb +1 -1
  38. data/lib/rdoc/discover.rb +1 -1
  39. data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
  40. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  41. data/stdlib/date/0/date.rbs +67 -59
  42. data/stdlib/date/0/date_time.rbs +1 -1
  43. data/stdlib/json/0/json.rbs +1 -0
  44. data/stdlib/objspace/0/objspace.rbs +1 -1
  45. data/stdlib/openssl/0/openssl.rbs +150 -80
  46. data/stdlib/psych/0/psych.rbs +3 -3
  47. data/stdlib/stringio/0/stringio.rbs +796 -37
  48. data/stdlib/strscan/0/string_scanner.rbs +1 -1
  49. data/stdlib/tempfile/0/tempfile.rbs +2 -2
  50. data/stdlib/time/0/time.rbs +1 -1
  51. data/stdlib/timeout/0/timeout.rbs +63 -7
  52. data/stdlib/uri/0/generic.rbs +1 -1
  53. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dde36e1704f20a8ad83c8917f449343563d933baf90673a17d2570ec7c44f5a
4
- data.tar.gz: 051b863ff0f5fac88ff4ab53f3a8434601c3c42803495d354ad0a004c27e7655
3
+ metadata.gz: a9e4107a0a29610713b34bf84a13fd4e348257e56e865a40358e61312f158fe0
4
+ data.tar.gz: d9776ace0cb6e68ba97cd4bcdd2ade5e41ba909dbf562914053d64afad118d1c
5
5
  SHA512:
6
- metadata.gz: 9820f43da6cb10c74015b212a9b37f1f1b4b46e1d8d9ec0c7e1c7304bdc49024691db5f03b776179715161e75eec166c5179eeab63adbd4e1044a811de7f8bc6
7
- data.tar.gz: 1b75689099bd54f88dd2fd30b73fa98a2d0b76894c817b59e236109eb4924a9141d52d8454a82aef98bbe6dbb05ee5b8da9bf6d66254cba88797c39de020ddd5
6
+ metadata.gz: 8805e28d9b760da1aa847fb8fa5ed26f26a2dc7309a37d861a178a511bfac68181955324803b42f64aada55cdd8806522c682b0980457aded2279f6493611eb0
7
+ data.tar.gz: 4ffa069bffbcaa8e869d30f50dbe42344f624691acea5e9aa1ff8c665f4749c32c8450d5b2dab0e6ed3fc94e4bc67f8c82a833ac5cb167f35c4cb17eaeb59d45
@@ -12,7 +12,7 @@ jobs:
12
12
  - uses: actions/checkout@v4
13
13
  - uses: ruby/setup-ruby@v1
14
14
  with:
15
- ruby-version: "4.0.0-preview2"
15
+ ruby-version: "4.0.0-preview3"
16
16
  bundler-cache: none
17
17
  - name: Set working directory as safe
18
18
  run: git config --global --add safe.directory $(pwd)
@@ -11,12 +11,12 @@ jobs:
11
11
  comments:
12
12
  runs-on: "ubuntu-latest"
13
13
  env:
14
- RUBY_COMMIT: v4.0.0-preview2
14
+ RUBY_COMMIT: v4.0.0-preview3
15
15
  steps:
16
16
  - uses: actions/checkout@v4
17
17
  - uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "4.0.0-preview2"
19
+ ruby-version: "4.0.0-preview3"
20
20
  bundler: none
21
21
  - name: Install dependencies
22
22
  run: |
@@ -13,24 +13,24 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: ['3.2', '3.3', '3.4', '4.0.0-preview2', head]
16
+ ruby: ['3.2', '3.3', '3.4', '4.0.0-preview3', head]
17
17
  rubyopt: [""]
18
18
  job:
19
19
  - test
20
20
  include:
21
21
  - ruby: head
22
22
  job: stdlib_test rubocop
23
- - ruby: "4.0.0-preview2"
23
+ - ruby: "4.0.0-preview3"
24
24
  job: stdlib_test
25
- - ruby: "4.0.0-preview2"
25
+ - ruby: "4.0.0-preview3"
26
26
  job: test
27
27
  rubyopt: "--enable-frozen-string-literal"
28
- - ruby: "4.0.0-preview2"
28
+ - ruby: "4.0.0-preview3"
29
29
  job: stdlib_test
30
30
  rubyopt: "--enable-frozen-string-literal"
31
- - ruby: "4.0.0-preview2"
31
+ - ruby: "4.0.0-preview3"
32
32
  job: rubocop validate test_doc build test_generate_stdlib raap
33
- - ruby: "4.0.0-preview2"
33
+ - ruby: "4.0.0-preview3"
34
34
  job: typecheck_test
35
35
  env:
36
36
  RANDOMIZE_STDLIB_TEST_ORDER: "true"
@@ -94,7 +94,7 @@ jobs:
94
94
  strategy:
95
95
  fail-fast: false
96
96
  matrix:
97
- ruby: ['4.0.0-preview2', head]
97
+ ruby: ['4.0.0-preview3', head]
98
98
  steps:
99
99
  - uses: actions/checkout@v4
100
100
  - name: Install dependencies
data/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.10.0 (2025-12-23)
4
+
5
+ RBS 3.10.0 ships with a pure C parser implementation, signature updates for Ruby 4.0, and various bug fixes.
6
+
7
+ ### Pure C parser implementation
8
+
9
+ The new parser implementation was announced at [RubyKaigi 2025](https://rubykaigi.org/2025/presentations/amomchilov.html) and is finally shipped as a RubyGem!
10
+
11
+ The new parser is faster than the one in 3.9 and is portable — it is independent of the Ruby runtime and is used to implement Sorbet’s RBS support.
12
+
13
+ ### Type definition of bundled gems
14
+
15
+ The type definitions of `cgi` have been moved to [gem_rbs_collection](https://github.com/ruby/gem_rbs_collection/tree/main/gems/cgi), as it has been migrated to a bundled gem in Ruby 4.0
16
+
17
+ `cgi-escape` has been added to `stdlib`. You may need to declare a dependency on `cgi-escape` in your `manifest.yaml`, add `-r cgi-escape` to your command line, or update your type checker configuration.
18
+
19
+ ```yaml
20
+ dependencies:
21
+ - name: cgi-escape
22
+ ```
23
+
24
+ The type definitions for `pathname` have also been moved from `stdlib` to `core`, as it is now implemented as part of the core library.
25
+
26
+ ### Pull Requests
27
+
28
+ * [Backport] Support rdoc v7 ([#2770](https://github.com/ruby/rbs/pull/2770))
29
+ * [Backport] Check tuple type length ([#2766](https://github.com/ruby/rbs/pull/2766))
30
+ * Backport update to 4.0.0-preview3 ([#2768](https://github.com/ruby/rbs/pull/2768))
31
+ * [Backport] Remove test code for bundled gems ([#2762](https://github.com/ruby/rbs/pull/2762))
32
+ * Merge pull request #2761 from ruby/update-minitest ([#2763](https://github.com/ruby/rbs/pull/2763))
33
+ * [Backport] Support BigDecimal v4 ([#2759](https://github.com/ruby/rbs/pull/2759))
34
+ * Parser/lexer backports ([#2756](https://github.com/ruby/rbs/pull/2756))
35
+ * Merge pull request #2753 from ruby/delete-printf ([#2754](https://github.com/ruby/rbs/pull/2754))
36
+ * Backports ([#2751](https://github.com/ruby/rbs/pull/2751))
37
+ * Merge pull request #2728 from ruby/cgi ([#2747](https://github.com/ruby/rbs/pull/2747))
38
+ * Merge pull request #2729 from ruby/rbs-assert ([#2748](https://github.com/ruby/rbs/pull/2748))
39
+ * Merge pull request #2749 from ruby/fix-test ([#2750](https://github.com/ruby/rbs/pull/2750))
40
+ * Backport RBS file updates ([#2742](https://github.com/ruby/rbs/pull/2742))
41
+ * Backport JSON PRs ([#2740](https://github.com/ruby/rbs/pull/2740))
42
+ * Merge pull request #2718 from ruby/ruby-4 ([#2741](https://github.com/ruby/rbs/pull/2741))
43
+ * [Backport] Move Pathname to core from stdlib ([#2730](https://github.com/ruby/rbs/pull/2730))
44
+ * Backport rdoc 6.16 ([#2722](https://github.com/ruby/rbs/pull/2722))
45
+ * Backport rdoc support ([#2719](https://github.com/ruby/rbs/pull/2719))
46
+ * Backport "Remove sig for IO#{ready?,nread}" ([#2720](https://github.com/ruby/rbs/pull/2720))
47
+ * Backport more pure C parsers ([#2679](https://github.com/ruby/rbs/pull/2679))
48
+ * Backport module name normalization ([#2673](https://github.com/ruby/rbs/pull/2673))
49
+ * Backport pure-C parser ([#2671](https://github.com/ruby/rbs/pull/2671))
50
+ * Fix test failure ([#2672](https://github.com/ruby/rbs/pull/2672))
51
+
3
52
  ## 3.9.5 (2025-09-08)
4
53
 
5
54
  ### Signature updates
data/core/array.rbs CHANGED
@@ -1213,7 +1213,7 @@ class Array[unchecked out Elem] < Object
1213
1213
  # Returns the element from `self` found by a binary search, or `nil` if the
1214
1214
  # search found no suitable element.
1215
1215
  #
1216
- # See [Binary Searching](rdoc-ref:bsearch.rdoc).
1216
+ # See [Binary Searching](rdoc-ref:language/bsearch.rdoc).
1217
1217
  #
1218
1218
  # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
1219
1219
  #
@@ -1229,7 +1229,7 @@ class Array[unchecked out Elem] < Object
1229
1229
  # Returns the integer index of the element from `self` found by a binary search,
1230
1230
  # or `nil` if the search found no suitable element.
1231
1231
  #
1232
- # See [Binary Searching](rdoc-ref:bsearch.rdoc).
1232
+ # See [Binary Searching](rdoc-ref:language/bsearch.rdoc).
1233
1233
  #
1234
1234
  # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
1235
1235
  #
@@ -2019,6 +2019,32 @@ class Array[unchecked out Elem] < Object
2019
2019
  def filter!: () { (Elem item) -> boolish } -> self?
2020
2020
  | () -> ::Enumerator[Elem, self?]
2021
2021
 
2022
+ # <!--
2023
+ # rdoc-file=array.c
2024
+ # - find(if_none_proc = nil) {|element| ... } -> object or nil
2025
+ # - find(if_none_proc = nil) -> enumerator
2026
+ # -->
2027
+ # Returns the first element for which the block returns a truthy value.
2028
+ #
2029
+ # With a block given, calls the block with successive elements of the array;
2030
+ # returns the first element for which the block returns a truthy value:
2031
+ #
2032
+ # (0..9).find {|element| element > 2} # => 3
2033
+ #
2034
+ # If no such element is found, calls `if_none_proc` and returns its return
2035
+ # value.
2036
+ #
2037
+ # (0..9).find(proc {false}) {|element| element > 12} # => false
2038
+ # {foo: 0, bar: 1, baz: 2}.find {|key, value| key.start_with?('b') } # => [:bar, 1]
2039
+ # {foo: 0, bar: 1, baz: 2}.find(proc {[]}) {|key, value| key.start_with?('c') } # => []
2040
+ #
2041
+ # With no block given, returns an Enumerator.
2042
+ #
2043
+ def find: () { (Elem) -> boolish } -> Elem?
2044
+ | () -> ::Enumerator[Elem, Elem?]
2045
+ | [T] (Enumerable::_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
2046
+ | [T] (Enumerable::_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
2047
+
2022
2048
  # <!--
2023
2049
  # rdoc-file=array.c
2024
2050
  # - find_index(object) -> integer or nil
@@ -2618,7 +2644,7 @@ class Array[unchecked out Elem] < Object
2618
2644
  # - pack(template, buffer: nil) -> string
2619
2645
  # -->
2620
2646
  # Formats each element in `self` into a binary string; returns that string. See
2621
- # [Packed Data](rdoc-ref:packed_data.rdoc).
2647
+ # [Packed Data](rdoc-ref:language/packed_data.rdoc).
2622
2648
  #
2623
2649
  def pack: (string fmt, ?buffer: String?) -> String
2624
2650
 
@@ -2988,6 +3014,33 @@ class Array[unchecked out Elem] < Object
2988
3014
  def reverse_each: () { (Elem item) -> void } -> self
2989
3015
  | () -> ::Enumerator[Elem, self]
2990
3016
 
3017
+ # <!--
3018
+ # rdoc-file=array.c
3019
+ # - rfind(if_none_proc = nil) {|element| ... } -> object or nil
3020
+ # - rfind(if_none_proc = nil) -> enumerator
3021
+ # -->
3022
+ # Returns the last element for which the block returns a truthy value.
3023
+ #
3024
+ # With a block given, calls the block with successive elements of the array in
3025
+ # reverse order; returns the last element for which the block returns a truthy
3026
+ # value:
3027
+ #
3028
+ # (0..9).rfind {|element| element < 5} # => 4
3029
+ #
3030
+ # If no such element is found, calls `if_none_proc` and returns its return
3031
+ # value.
3032
+ #
3033
+ # (0..9).rfind(proc {false}) {|element| element < -2} # => false
3034
+ # {foo: 0, bar: 1, baz: 2}.rfind {|key, value| key.start_with?('b') } # => [:baz, 2]
3035
+ # {foo: 0, bar: 1, baz: 2}.rfind(proc {[]}) {|key, value| key.start_with?('c') } # => []
3036
+ #
3037
+ # With no block given, returns an Enumerator.
3038
+ #
3039
+ def rfind: () { (Elem) -> boolish } -> Elem?
3040
+ | () -> ::Enumerator[Elem, Elem?]
3041
+ | [T] (Enumerable::_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
3042
+ | [T] (Enumerable::_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
3043
+
2991
3044
  # <!--
2992
3045
  # rdoc-file=array.c
2993
3046
  # - rindex(object) -> integer or nil
data/core/complex.rbs CHANGED
@@ -184,23 +184,24 @@ class Complex < Numeric
184
184
 
185
185
  # <!--
186
186
  # rdoc-file=complex.c
187
- # - complex * numeric -> new_complex
187
+ # - self * other -> numeric
188
188
  # -->
189
- # Returns the product of `self` and `numeric`:
189
+ # Returns the numeric product of `self` and `other`:
190
190
  #
191
+ # Complex.rect(9, 8) * 4 # => (36+32i)
192
+ # Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
191
193
  # Complex.rect(2, 3) * Complex.rect(2, 3) # => (-5+12i)
192
194
  # Complex.rect(900) * Complex.rect(1) # => (900+0i)
193
195
  # Complex.rect(-2, 9) * Complex.rect(-9, 2) # => (0-85i)
194
- # Complex.rect(9, 8) * 4 # => (36+32i)
195
- # Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
196
+ # Complex.rect(9, 8) * Rational(2, 3) # => ((6/1)+(16/3)*i)
196
197
  #
197
198
  def *: (Numeric) -> Complex
198
199
 
199
200
  # <!--
200
201
  # rdoc-file=complex.c
201
- # - complex ** numeric -> new_complex
202
+ # - self ** exponent -> complex
202
203
  # -->
203
- # Returns `self` raised to power `numeric`:
204
+ # Returns `self` raised to the power `exponent`:
204
205
  #
205
206
  # Complex.rect(0, 1) ** 2 # => (-1+0i)
206
207
  # Complex.rect(-8) ** Rational(1, 3) # => (1.0000000000000002+1.7320508075688772i)
@@ -209,15 +210,25 @@ class Complex < Numeric
209
210
 
210
211
  # <!--
211
212
  # rdoc-file=complex.c
212
- # - complex + numeric -> new_complex
213
+ # - self + other -> numeric
213
214
  # -->
214
- # Returns the sum of `self` and `numeric`:
215
+ # Returns the sum of `self` and `other`:
216
+ #
217
+ # Complex(1, 2) + 0 # => (1+2i)
218
+ # Complex(1, 2) + 1 # => (2+2i)
219
+ # Complex(1, 2) + -1 # => (0+2i)
220
+ #
221
+ # Complex(1, 2) + 1.0 # => (2.0+2i)
222
+ #
223
+ # Complex(1, 2) + Complex(2, 1) # => (3+3i)
224
+ # Complex(1, 2) + Complex(2.0, 1.0) # => (3.0+3.0i)
225
+ #
226
+ # Complex(1, 2) + Rational(1, 1) # => ((2/1)+2i)
227
+ # Complex(1, 2) + Rational(1, 2) # => ((3/2)+2i)
228
+ #
229
+ # For a computation involving Floats, the result may be inexact (see Float#+):
215
230
  #
216
- # Complex.rect(2, 3) + Complex.rect(2, 3) # => (4+6i)
217
- # Complex.rect(900) + Complex.rect(1) # => (901+0i)
218
- # Complex.rect(-2, 9) + Complex.rect(-9, 2) # => (-11+11i)
219
- # Complex.rect(9, 8) + 4 # => (13+8i)
220
- # Complex.rect(20, 9) + 9.8 # => (29.8+9i)
231
+ # Complex(1, 2) + 3.14 # => (4.140000000000001+2i)
221
232
  #
222
233
  def +: (Numeric) -> Complex
223
234
 
@@ -225,9 +236,9 @@ class Complex < Numeric
225
236
 
226
237
  # <!--
227
238
  # rdoc-file=complex.c
228
- # - complex - numeric -> new_complex
239
+ # - self - other -> complex
229
240
  # -->
230
- # Returns the difference of `self` and `numeric`:
241
+ # Returns the difference of `self` and `other`:
231
242
  #
232
243
  # Complex.rect(2, 3) - Complex.rect(2, 3) # => (0+0i)
233
244
  # Complex.rect(900) - Complex.rect(1) # => (899+0i)
@@ -239,9 +250,9 @@ class Complex < Numeric
239
250
 
240
251
  # <!--
241
252
  # rdoc-file=complex.c
242
- # - -complex -> new_complex
253
+ # - -self -> complex
243
254
  # -->
244
- # Returns the negation of `self`, which is the negation of each of its parts:
255
+ # Returns `self`, negated, which is the negation of each of its parts:
245
256
  #
246
257
  # -Complex.rect(1, 2) # => (-1-2i)
247
258
  # -Complex.rect(-1, -2) # => (1+2i)
@@ -250,9 +261,9 @@ class Complex < Numeric
250
261
 
251
262
  # <!--
252
263
  # rdoc-file=complex.c
253
- # - complex / numeric -> new_complex
264
+ # - self / other -> complex
254
265
  # -->
255
- # Returns the quotient of `self` and `numeric`:
266
+ # Returns the quotient of `self` and `other`:
256
267
  #
257
268
  # Complex.rect(2, 3) / Complex.rect(2, 3) # => (1+0i)
258
269
  # Complex.rect(900) / Complex.rect(1) # => (900+0i)
@@ -594,9 +605,9 @@ class Complex < Numeric
594
605
 
595
606
  # <!--
596
607
  # rdoc-file=complex.c
597
- # - complex / numeric -> new_complex
608
+ # - self / other -> complex
598
609
  # -->
599
- # Returns the quotient of `self` and `numeric`:
610
+ # Returns the quotient of `self` and `other`:
600
611
  #
601
612
  # Complex.rect(2, 3) / Complex.rect(2, 3) # => (1+0i)
602
613
  # Complex.rect(900) / Complex.rect(1) # => (900+0i)
data/core/encoding.rbs CHANGED
@@ -281,7 +281,7 @@ class Encoding
281
281
  def inspect: () -> String
282
282
 
283
283
  # <!-- rdoc-file=encoding.c -->
284
- # Returns the name of the encoding.
284
+ # The name of the encoding.
285
285
  #
286
286
  # Encoding::UTF_8.name #=> "UTF-8"
287
287
  #
@@ -297,12 +297,8 @@ class Encoding
297
297
  #
298
298
  def names: () -> Array[String]
299
299
 
300
- # <!--
301
- # rdoc-file=encoding.c
302
- # - enc.name -> string
303
- # - enc.to_s -> string
304
- # -->
305
- # Returns the name of the encoding.
300
+ # <!-- rdoc-file=encoding.c -->
301
+ # The name of the encoding.
306
302
  #
307
303
  # Encoding::UTF_8.name #=> "UTF-8"
308
304
  #
data/core/enumerable.rbs CHANGED
@@ -2127,7 +2127,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
2127
2127
  # ["F", 6860]
2128
2128
  #
2129
2129
  # You can use the special symbol `:_alone` to force an element into its own
2130
- # separate chuck:
2130
+ # separate chunk:
2131
2131
  #
2132
2132
  # a = [0, 0, 1, 1]
2133
2133
  # e = a.chunk{|i| i.even? ? :_alone : true }
data/core/enumerator.rbs CHANGED
@@ -137,7 +137,7 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
137
137
 
138
138
  # <!--
139
139
  # rdoc-file=enumerator.c
140
- # - Enumerator.produce(initial = nil) { |prev| block } -> enumerator
140
+ # - Enumerator.produce(initial = nil, size: nil) { |prev| block } -> enumerator
141
141
  # -->
142
142
  # Creates an infinite enumerator from any block, just called over and over. The
143
143
  # result of the previous iteration is passed to the next one. If `initial` is
@@ -169,6 +169,23 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
169
169
  # Enumerator.produce { scanner.scan(PATTERN) }.slice_after { scanner.eos? }.first
170
170
  # # => ["7", "+", "38", "/", "6"]
171
171
  #
172
+ # The optional `size` keyword argument specifies the size of the enumerator,
173
+ # which can be retrieved by Enumerator#size. It can be an integer,
174
+ # `Float::INFINITY`, a callable object (such as a lambda), or `nil` to indicate
175
+ # unknown size. When not specified, the size defaults to `Float::INFINITY`.
176
+ #
177
+ # # Infinite enumerator
178
+ # enum = Enumerator.produce(1, size: Float::INFINITY, &:succ)
179
+ # enum.size # => Float::INFINITY
180
+ #
181
+ # # Finite enumerator with known/computable size
182
+ # abs_dir = File.expand_path("./baz") # => "/foo/bar/baz"
183
+ # traverser = Enumerator.produce(abs_dir, size: -> { abs_dir.count("/") + 1 }) {
184
+ # raise StopIteration if it == "/"
185
+ # File.dirname(it)
186
+ # }
187
+ # traverser.size # => 4
188
+ #
172
189
  def self.produce: [T] () { (T? prev) -> T } -> Enumerator[T, bot]
173
190
  | [T] (T initial) { (T prev) -> T } -> Enumerator[T, bot]
174
191
 
data/core/fiber.rbs CHANGED
@@ -82,7 +82,8 @@ class Fiber < Object
82
82
  # -->
83
83
  # Returns the value of the fiber storage variable identified by `key`.
84
84
  #
85
- # The `key` must be a symbol, and the value is set by Fiber#[]= or Fiber#store.
85
+ # The `key` must be a symbol, and the value is set by Fiber#[]= or
86
+ # Fiber#storage.
86
87
  #
87
88
  # See also Fiber::[]=.
88
89
  #
data/core/file.rbs CHANGED
@@ -1414,7 +1414,7 @@ class File < IO
1414
1414
  # rdoc-file=file.c
1415
1415
  # - File.owned?(file_name) -> true or false
1416
1416
  # -->
1417
- # Returns `true` if the named file exists and the effective used id of the
1417
+ # Returns `true` if the named file exists and the effective user id of the
1418
1418
  # calling process is the owner of the file.
1419
1419
  #
1420
1420
  # *file_name* can be an IO object.
data/core/file_test.rbs CHANGED
@@ -145,7 +145,7 @@ module FileTest
145
145
  # rdoc-file=file.c
146
146
  # - File.owned?(file_name) -> true or false
147
147
  # -->
148
- # Returns `true` if the named file exists and the effective used id of the
148
+ # Returns `true` if the named file exists and the effective user id of the
149
149
  # calling process is the owner of the file.
150
150
  #
151
151
  # *file_name* can be an IO object.