rbs 3.10.0 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9e4107a0a29610713b34bf84a13fd4e348257e56e865a40358e61312f158fe0
4
- data.tar.gz: d9776ace0cb6e68ba97cd4bcdd2ade5e41ba909dbf562914053d64afad118d1c
3
+ metadata.gz: c0e199e19fdc063a93575bc59d1daff68480bc7c678e0b9a00a20bd882c0167f
4
+ data.tar.gz: 42415916b4eebb2b739ce009088fd8fcec8c02a8ad0c4169ccf57dd9b69bba79
5
5
  SHA512:
6
- metadata.gz: 8805e28d9b760da1aa847fb8fa5ed26f26a2dc7309a37d861a178a511bfac68181955324803b42f64aada55cdd8806522c682b0980457aded2279f6493611eb0
7
- data.tar.gz: 4ffa069bffbcaa8e869d30f50dbe42344f624691acea5e9aa1ff8c665f4749c32c8450d5b2dab0e6ed3fc94e4bc67f8c82a833ac5cb167f35c4cb17eaeb59d45
6
+ metadata.gz: a9ba79e77d4f6ca3b57f6a89e245e20edd6ceba274475ad435a4bfb45e78dc17e4ab3ca033b208279b4ee1bef0498d82459ef912bbc2dfcabb16c921f4802e72
7
+ data.tar.gz: 8c8100da156288e99931d15f0a3e61439a08d51e3d85605f95770d62cdfc4e1fd3cc71ede93763ce08e480084ed8301a26b781db3988b7fc931ea727fccd7e29
@@ -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-preview3"
15
+ ruby-version: "4.0"
16
16
  bundler-cache: none
17
17
  - name: Set working directory as safe
18
18
  run: git config --global --add safe.directory $(pwd)
@@ -10,13 +10,13 @@ on:
10
10
  jobs:
11
11
  comments:
12
12
  runs-on: "ubuntu-latest"
13
- env:
14
- RUBY_COMMIT: v4.0.0-preview3
13
+ # env:
14
+ # RUBY_COMMIT: v4.0.0-preview2
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-preview3"
19
+ ruby-version: "4.0.0"
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-preview3', head]
16
+ ruby: ['3.2', '3.3', '3.4', '4.0', 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-preview3"
23
+ - ruby: "4.0"
24
24
  job: stdlib_test
25
- - ruby: "4.0.0-preview3"
25
+ - ruby: "4.0"
26
26
  job: test
27
27
  rubyopt: "--enable-frozen-string-literal"
28
- - ruby: "4.0.0-preview3"
28
+ - ruby: "4.0"
29
29
  job: stdlib_test
30
30
  rubyopt: "--enable-frozen-string-literal"
31
- - ruby: "4.0.0-preview3"
31
+ - ruby: "4.0"
32
32
  job: rubocop validate test_doc build test_generate_stdlib raap
33
- - ruby: "4.0.0-preview3"
33
+ - ruby: "4.0"
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-preview3', head]
97
+ ruby: ['4.0', head]
98
98
  steps:
99
99
  - uses: actions/checkout@v4
100
100
  - name: Install dependencies
@@ -116,4 +116,3 @@ jobs:
116
116
  run: |
117
117
  bin/setup
118
118
  - run: bundle exec rake clean compile_c99
119
-
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.10.1 (2026-01-07)
4
+
5
+ This is a follow-up release for Ruby 4.0.0 with documentation update based on Ruby 4.0.0, and bugfixes related to set/pathname library loading.
6
+
7
+ ### Pull Requests
8
+
9
+ * Merge pull request #2777 from ksss/pathname-ext ([#2786](https://github.com/ruby/rbs/pull/2786))
10
+ * Ruby 4.0.0 backports ([#2785](https://github.com/ruby/rbs/pull/2785))
11
+ * [Backport] Fix subtraction of civar ([#2783](https://github.com/ruby/rbs/pull/2783))
12
+ * [Backport] Update ruby to 4.0 ([#2778](https://github.com/ruby/rbs/pull/2778))
13
+
3
14
  ## 3.10.0 (2025-12-23)
4
15
 
5
16
  RBS 3.10.0 ships with a pure C parser implementation, signature updates for Ruby 4.0, and various bug fixes.
data/core/array.rbs CHANGED
@@ -2029,14 +2029,12 @@ class Array[unchecked out Elem] < Object
2029
2029
  # With a block given, calls the block with successive elements of the array;
2030
2030
  # returns the first element for which the block returns a truthy value:
2031
2031
  #
2032
- # (0..9).find {|element| element > 2} # => 3
2032
+ # [1, 3, 5].find {|element| element > 2} # => 3
2033
2033
  #
2034
2034
  # If no such element is found, calls `if_none_proc` and returns its return
2035
2035
  # value.
2036
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') } # => []
2037
+ # [1, 3, 5].find(proc {-1}) {|element| element > 12} # => -1
2040
2038
  #
2041
2039
  # With no block given, returns an Enumerator.
2042
2040
  #
@@ -3022,17 +3020,15 @@ class Array[unchecked out Elem] < Object
3022
3020
  # Returns the last element for which the block returns a truthy value.
3023
3021
  #
3024
3022
  # 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
3023
+ # reverse order; returns the first element for which the block returns a truthy
3026
3024
  # value:
3027
3025
  #
3028
- # (0..9).rfind {|element| element < 5} # => 4
3026
+ # [1, 2, 3, 4, 5, 6].rfind {|element| element < 5} # => 4
3029
3027
  #
3030
3028
  # If no such element is found, calls `if_none_proc` and returns its return
3031
3029
  # value.
3032
3030
  #
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') } # => []
3031
+ # [1, 2, 3, 4].rfind(proc {0}) {|element| element < -2} # => 0
3036
3032
  #
3037
3033
  # With no block given, returns an Enumerator.
3038
3034
  #
data/core/comparable.rbs CHANGED
@@ -55,19 +55,26 @@
55
55
  module Comparable : _WithSpaceshipOperator
56
56
  # <!--
57
57
  # rdoc-file=compar.c
58
- # - obj < other -> true or false
58
+ # - self < other -> true or false
59
59
  # -->
60
- # Compares two objects based on the receiver's `<=>` method, returning true if
61
- # it returns a value less than 0.
60
+ # Returns whether `self` is "less than" `other`; equivalent to `(self <=> other)
61
+ # < 0`:
62
+ #
63
+ # 'foo' < 'foo' # => false
64
+ # 'foo' < 'food' # => true
62
65
  #
63
66
  def <: (untyped other) -> bool
64
67
 
65
68
  # <!--
66
69
  # rdoc-file=compar.c
67
- # - obj <= other -> true or false
70
+ # - self <= other -> true or false
68
71
  # -->
69
- # Compares two objects based on the receiver's `<=>` method, returning true if
70
- # it returns a value less than or equal to 0.
72
+ # Returns whether `self` is "less than or equal to" `other`; equivalent to
73
+ # `(self <=> other) <= 0`:
74
+ #
75
+ # 'foo' <= 'foo' # => true
76
+ # 'foo' <= 'food' # => true
77
+ # 'food' <= 'foo' # => false
71
78
  #
72
79
  def <=: (untyped other) -> bool
73
80
 
data/core/complex.rbs CHANGED
@@ -279,15 +279,16 @@ class Complex < Numeric
279
279
 
280
280
  # <!--
281
281
  # rdoc-file=complex.c
282
- # - complex <=> object -> -1, 0, 1, or nil
282
+ # - self <=> other -> -1, 0, 1, or nil
283
283
  # -->
284
+ # Compares `self` and `other`.
285
+ #
284
286
  # Returns:
285
287
  #
286
- # * `self.real <=> object.real` if both of the following are true:
288
+ # * `self.real <=> other.real` if both of the following are true:
287
289
  #
288
290
  # * `self.imag == 0`.
289
- # * `object.imag == 0`. # Always true if object is numeric but not
290
- # complex.
291
+ # * `other.imag == 0` (always true if `other` is numeric but not complex).
291
292
  #
292
293
  # * `nil` otherwise.
293
294
  #
@@ -300,6 +301,9 @@ class Complex < Numeric
300
301
  # Complex.rect(1) <=> Complex.rect(1, 1) # => nil # object.imag not zero.
301
302
  # Complex.rect(1) <=> 'Foo' # => nil # object.imag not defined.
302
303
  #
304
+ # Class Complex includes module Comparable, each of whose methods uses
305
+ # Complex#<=> for comparison.
306
+ #
303
307
  def <=>: (untyped) -> Integer?
304
308
 
305
309
  # <!--
data/core/dir.rbs CHANGED
@@ -171,7 +171,7 @@ class Dir
171
171
  # system's encoding is used:
172
172
  #
173
173
  # Dir.new('.').read.encoding # => #<Encoding:UTF-8>
174
- # Dir.new('.', encoding: 'US-ASCII').read.encoding # => #<Encoding:US-ASCII>
174
+ # Dir.new('.', encoding: Encoding::US_ASCI).read.encoding # => #<Encoding:US-ASCII>
175
175
  #
176
176
  def initialize: (path dir, ?encoding: encoding?) -> void
177
177
 
@@ -704,7 +704,7 @@ class Dir
704
704
  # system's encoding is used:
705
705
  #
706
706
  # Dir.open('.').read.encoding # => #<Encoding:UTF-8>
707
- # Dir.open('.', encoding: 'US-ASCII').read.encoding # => #<Encoding:US-ASCII>
707
+ # Dir.open('.', encoding: Encoding::US_ASCII).read.encoding # => #<Encoding:US-ASCII>
708
708
  #
709
709
  def self.open: (path dirname, ?encoding: encoding?) -> instance
710
710
  | [U] (path dirname, ?encoding: encoding?) { (instance) -> U } -> U
data/core/enumerator.rbs CHANGED
@@ -186,6 +186,12 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
186
186
  # }
187
187
  # traverser.size # => 4
188
188
  #
189
+ # # Finite enumerator with unknown size
190
+ # calendar = Enumerator.produce(Date.today, size: nil) {
191
+ # it.monday? ? raise(StopIteration) : it + 1
192
+ # }
193
+ # calendar.size # => nil
194
+ #
189
195
  def self.produce: [T] () { (T? prev) -> T } -> Enumerator[T, bot]
190
196
  | [T] (T initial) { (T prev) -> T } -> Enumerator[T, bot]
191
197
 
@@ -463,6 +469,25 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
463
469
  # loop.size # => Float::INFINITY
464
470
  # (1..100).drop_while.size # => nil
465
471
  #
472
+ # Note that enumerator size might be inaccurate, and should be rather treated as
473
+ # a hint. For example, there is no check that the size provided to ::new is
474
+ # accurate:
475
+ #
476
+ # e = Enumerator.new(5) { |y| 2.times { y << it} }
477
+ # e.size # => 5
478
+ # e.to_a.size # => 2
479
+ #
480
+ # Another example is an enumerator created by ::produce without a `size`
481
+ # argument. Such enumerators return `Infinity` for size, but this is inaccurate
482
+ # if the passed block raises StopIteration:
483
+ #
484
+ # e = Enumerator.produce(1) { it + 1 }
485
+ # e.size # => Infinity
486
+ #
487
+ # e = Enumerator.produce(1) { it > 3 ? raise(StopIteration) : it + 1 }
488
+ # e.size # => Infinity
489
+ # e.to_a.size # => 4
490
+ #
466
491
  def size: () -> (Integer | Float)?
467
492
 
468
493
  # <!--
data/core/fiber.rbs CHANGED
@@ -393,27 +393,35 @@ class Fiber < Object
393
393
 
394
394
  # <!--
395
395
  # rdoc-file=cont.c
396
- # - fiber.raise -> obj
397
- # - fiber.raise(string) -> obj
398
- # - fiber.raise(exception [, string [, array]]) -> obj
396
+ # - raise(exception, message = exception.to_s, backtrace = nil, cause: $!)
397
+ # - raise(message = nil, cause: $!)
399
398
  # -->
400
399
  # Raises an exception in the fiber at the point at which the last `Fiber.yield`
401
- # was called. If the fiber has not been started or has already run to
402
- # completion, raises `FiberError`. If the fiber is yielding, it is resumed. If
403
- # it is transferring, it is transferred into. But if it is resuming, raises
404
- # `FiberError`.
405
- #
406
- # With no arguments, raises a `RuntimeError`. With a single `String` argument,
407
- # raises a `RuntimeError` with the string as a message. Otherwise, the first
408
- # parameter should be the name of an `Exception` class (or an object that
409
- # returns an `Exception` object when sent an `exception` message). The optional
410
- # second parameter sets the message associated with the exception, and the third
411
- # parameter is an array of callback information. Exceptions are caught by the
412
- # `rescue` clause of `begin...end` blocks.
400
+ # was called.
401
+ #
402
+ # f = Fiber.new {
403
+ # puts "Before the yield"
404
+ # Fiber.yield 1 # -- exception will be raised here
405
+ # puts "After the yield"
406
+ # }
407
+ #
408
+ # p f.resume
409
+ # f.raise "Gotcha"
410
+ #
411
+ # Output
412
+ #
413
+ # Before the first yield
414
+ # 1
415
+ # t.rb:8:in 'Fiber.yield': Gotcha (RuntimeError)
416
+ # from t.rb:8:in 'block in <main>'
417
+ #
418
+ # If the fiber has not been started or has already run to completion, raises
419
+ # `FiberError`. If the fiber is yielding, it is resumed. If it is transferring,
420
+ # it is transferred into. But if it is resuming, raises `FiberError`.
413
421
  #
414
422
  # Raises `FiberError` if called on a Fiber belonging to another `Thread`.
415
423
  #
416
- # See Kernel#raise for more information.
424
+ # See Kernel#raise for more information on arguments.
417
425
  #
418
426
  def raise: (?string msg, ?cause: Exception?) -> untyped
419
427
  | (_Exception, ?string msg, ?Array[string] | Array[Thread::Backtrace::Location] | nil backtrace, ?cause: Exception?) -> untyped
data/core/file.rbs CHANGED
@@ -2455,16 +2455,31 @@ class File::Stat < Object
2455
2455
 
2456
2456
  # <!--
2457
2457
  # rdoc-file=file.c
2458
- # - stat <=> other_stat -> -1, 0, 1, nil
2458
+ # - self <=> other -> -1, 0, 1, or nil
2459
2459
  # -->
2460
- # Compares File::Stat objects by comparing their respective modification times.
2460
+ # Compares `self` and `other`, by comparing their modification times; that is,
2461
+ # by comparing `self.mtime` and `other.mtime`.
2461
2462
  #
2462
- # `nil` is returned if `other_stat` is not a File::Stat object
2463
+ # Returns:
2463
2464
  #
2464
- # f1 = File.new("f1", "w")
2465
- # sleep 1
2466
- # f2 = File.new("f2", "w")
2467
- # f1.stat <=> f2.stat #=> -1
2465
+ # * `-1`, if `self.mtime` is earlier.
2466
+ # * `0`, if the two values are equal.
2467
+ # * `1`, if `self.mtime` is later.
2468
+ # * `nil`, if `other` is not a File::Stat object.
2469
+ #
2470
+ # Examples:
2471
+ #
2472
+ # stat0 = File.stat('README.md')
2473
+ # stat1 = File.stat('NEWS.md')
2474
+ # stat0.mtime # => 2025-12-20 15:33:05.6972341 -0600
2475
+ # stat1.mtime # => 2025-12-20 16:02:08.2672945 -0600
2476
+ # stat0 <=> stat1 # => -1
2477
+ # stat0 <=> stat0.dup # => 0
2478
+ # stat1 <=> stat0 # => 1
2479
+ # stat0 <=> :foo # => nil
2480
+ #
2481
+ # Class File::Stat includes module Comparable, each of whose methods uses
2482
+ # File::Stat#<=> for comparison.
2468
2483
  #
2469
2484
  def <=>: (File::Stat other) -> Integer
2470
2485
  | (untyped) -> nil
data/core/float.rbs CHANGED
@@ -384,7 +384,8 @@ class Float < Numeric
384
384
  # rdoc-file=numeric.c
385
385
  # - self < other -> true or false
386
386
  # -->
387
- # Returns `true` if `self` is numerically less than `other`:
387
+ # Returns whether the value of `self` is less than the value of `other`; `other`
388
+ # must be numeric, but may not be Complex:
388
389
  #
389
390
  # 2.0 < 3 # => true
390
391
  # 2.0 < 3.0 # => true
@@ -399,7 +400,8 @@ class Float < Numeric
399
400
  # rdoc-file=numeric.c
400
401
  # - self <= other -> true or false
401
402
  # -->
402
- # Returns `true` if `self` is numerically less than or equal to `other`:
403
+ # Returns whether the value of `self` is less than or equal to the value of
404
+ # `other`; `other` must be numeric, but may not be Complex:
403
405
  #
404
406
  # 2.0 <= 3 # => true
405
407
  # 2.0 <= 3.0 # => true
@@ -413,30 +415,32 @@ class Float < Numeric
413
415
 
414
416
  # <!--
415
417
  # rdoc-file=numeric.c
416
- # - self <=> other -> -1, 0, +1, or nil
418
+ # - self <=> other -> -1, 0, 1, or nil
417
419
  # -->
418
- # Returns a value that depends on the numeric relation between `self` and
419
- # `other`:
420
+ # Compares `self` and `other`.
420
421
  #
421
- # * -1, if `self` is less than `other`.
422
- # * 0, if `self` is equal to `other`.
423
- # * 1, if `self` is greater than `other`.
422
+ # Returns:
423
+ #
424
+ # * `-1`, if `self` is less than `other`.
425
+ # * `0`, if `self` is equal to `other`.
426
+ # * `1`, if `self` is greater than `other`.
424
427
  # * `nil`, if the two values are incommensurate.
425
428
  #
426
429
  # Examples:
427
430
  #
431
+ # 2.0 <=> 2.1 # => -1
428
432
  # 2.0 <=> 2 # => 0
429
433
  # 2.0 <=> 2.0 # => 0
430
434
  # 2.0 <=> Rational(2, 1) # => 0
431
435
  # 2.0 <=> Complex(2, 0) # => 0
432
436
  # 2.0 <=> 1.9 # => 1
433
- # 2.0 <=> 2.1 # => -1
434
437
  # 2.0 <=> 'foo' # => nil
435
438
  #
436
- # This is the basis for the tests in the Comparable module.
437
- #
438
439
  # `Float::NAN <=> Float::NAN` returns an implementation-dependent value.
439
440
  #
441
+ # Class Float includes module Comparable, each of whose methods uses Float#<=>
442
+ # for comparison.
443
+ #
440
444
  def <=>: (Numeric) -> Integer?
441
445
 
442
446
  # <!--
data/core/hash.rbs CHANGED
@@ -534,10 +534,10 @@ class Hash[unchecked out K, unchecked out V] < Object
534
534
 
535
535
  # <!--
536
536
  # rdoc-file=hash.c
537
- # - self < other_hash -> true or false
537
+ # - self < other -> true or false
538
538
  # -->
539
- # Returns `true` if the entries of `self` are a proper subset of the entries of
540
- # `other_hash`, `false` otherwise:
539
+ # Returns whether the entries of `self` are a proper subset of the entries of
540
+ # `other`:
541
541
  #
542
542
  # h = {foo: 0, bar: 1}
543
543
  # h < {foo: 0, bar: 1, baz: 2} # => true # Proper subset.
@@ -558,10 +558,9 @@ class Hash[unchecked out K, unchecked out V] < Object
558
558
 
559
559
  # <!--
560
560
  # rdoc-file=hash.c
561
- # - self <= other_hash -> true or false
561
+ # - self <= other -> true or false
562
562
  # -->
563
- # Returns `true` if the entries of `self` are a subset of the entries of
564
- # `other_hash`, `false` otherwise:
563
+ # Returns whether the entries of `self` are a subset of the entries of `other`:
565
564
  #
566
565
  # h0 = {foo: 0, bar: 1}
567
566
  # h1 = {foo: 0, bar: 1, baz: 2}
data/core/integer.rbs CHANGED
@@ -340,15 +340,14 @@ class Integer < Numeric
340
340
  # rdoc-file=numeric.c
341
341
  # - self < other -> true or false
342
342
  # -->
343
- # Returns `true` if the value of `self` is less than that of `other`:
343
+ # Returns whether the value of `self` is less than the value of `other`; `other`
344
+ # must be numeric, but may not be Complex:
344
345
  #
345
- # 1 < 0 # => false
346
- # 1 < 1 # => false
347
- # 1 < 2 # => true
348
- # 1 < 0.5 # => false
349
- # 1 < Rational(1, 2) # => false
350
- #
351
- # Raises an exception if the comparison cannot be made.
346
+ # 1 < 0 # => false
347
+ # 1 < 1 # => false
348
+ # 1 < 2 # => true
349
+ # 1 < 0.5 # => false
350
+ # 1 < Rational(1, 2) # => false
352
351
  #
353
352
  def <: (Numeric) -> bool
354
353
 
@@ -371,44 +370,46 @@ class Integer < Numeric
371
370
 
372
371
  # <!--
373
372
  # rdoc-file=numeric.c
374
- # - self <= real -> true or false
373
+ # - self <= other -> true or false
375
374
  # -->
376
- # Returns `true` if the value of `self` is less than or equal to that of
377
- # `other`:
375
+ # Returns whether the value of `self` is less than or equal to the value of
376
+ # `other`; `other` must be numeric, but may not be Complex:
378
377
  #
379
- # 1 <= 0 # => false
380
- # 1 <= 1 # => true
381
- # 1 <= 2 # => true
382
- # 1 <= 0.5 # => false
383
- # 1 <= Rational(1, 2) # => false
378
+ # 1 <= 0 # => false
379
+ # 1 <= 1 # => true
380
+ # 1 <= 2 # => true
381
+ # 1 <= 0.5 # => false
382
+ # 1 <= Rational(1, 2) # => false
384
383
  #
385
- # Raises an exception if the comparison cannot be made.
384
+ # Raises an exception if the comparison cannot be made.
386
385
  #
387
386
  def <=: (Numeric) -> bool
388
387
 
389
388
  # <!--
390
389
  # rdoc-file=numeric.c
391
- # - self <=> other -> -1, 0, +1, or nil
390
+ # - self <=> other -> -1, 0, 1, or nil
392
391
  # -->
392
+ # Compares `self` and `other`.
393
+ #
393
394
  # Returns:
394
395
  #
395
- # * -1, if `self` is less than `other`.
396
- # * 0, if `self` is equal to `other`.
397
- # * 1, if `self` is greater then `other`.
396
+ # * `-1`, if `self` is less than `other`.
397
+ # * `0`, if `self` is equal to `other`.
398
+ # * `1`, if `self` is greater then `other`.
398
399
  # * `nil`, if `self` and `other` are incomparable.
399
400
  #
400
401
  # Examples:
401
402
  #
402
403
  # 1 <=> 2 # => -1
403
404
  # 1 <=> 1 # => 0
404
- # 1 <=> 0 # => 1
405
- # 1 <=> 'foo' # => nil
406
- #
407
405
  # 1 <=> 1.0 # => 0
408
406
  # 1 <=> Rational(1, 1) # => 0
409
407
  # 1 <=> Complex(1, 0) # => 0
408
+ # 1 <=> 0 # => 1
409
+ # 1 <=> 'foo' # => nil
410
410
  #
411
- # This method is the basis for comparisons in module Comparable.
411
+ # Class Integer includes module Comparable, each of whose methods uses
412
+ # Integer#<=> for comparison.
412
413
  #
413
414
  def <=>: (Integer | Rational) -> Integer
414
415
  | (untyped) -> Integer?
data/core/io/buffer.rbs CHANGED
@@ -64,9 +64,9 @@ class IO
64
64
  #
65
65
  # File.write('test.txt', 'test data')
66
66
  # # => 9
67
- # buffer = IO::Buffer.map(File.open('test.txt'))
67
+ # buffer = IO::Buffer.map(File.open('test.txt'), nil, 0, IO::Buffer::READONLY)
68
68
  # # =>
69
- # # #<IO::Buffer 0x00007f3f0768c000+9 MAPPED IMMUTABLE>
69
+ # # #<IO::Buffer 0x00007f3f0768c000+9 EXTERNAL MAPPED FILE SHARED READONLY>
70
70
  # # ...
71
71
  # buffer.get_string(5, 2) # read 2 bytes, starting from offset 5
72
72
  # # => "da"
@@ -113,7 +113,7 @@ class IO
113
113
  # buffer.get_string(0, 1)
114
114
  # # => "t"
115
115
  # string
116
- # # => "best"
116
+ # # => "test"
117
117
  #
118
118
  # buffer.resize(100)
119
119
  # # in `resize': Cannot resize external buffer! (IO::Buffer::AccessError)
data/core/kernel.rbs CHANGED
@@ -1004,6 +1004,8 @@ module Kernel : BasicObject
1004
1004
  # With argument `exception` not given, argument `message` and keyword argument
1005
1005
  # `cause` may be given, but argument `backtrace` may not be given.
1006
1006
  #
1007
+ # `cause` can not be given as an only argument.
1008
+ #
1007
1009
  def self?.fail: () -> bot
1008
1010
  | (string message, ?cause: Exception?) -> bot
1009
1011
  | (_Exception exception, ?_ToS? message, ?String | Array[String] | Array[Thread::Backtrace::Location] | nil backtrace, ?cause: Exception?) -> bot
@@ -1110,6 +1112,8 @@ module Kernel : BasicObject
1110
1112
  # With argument `exception` not given, argument `message` and keyword argument
1111
1113
  # `cause` may be given, but argument `backtrace` may not be given.
1112
1114
  #
1115
+ # `cause` can not be given as an only argument.
1116
+ #
1113
1117
  alias raise fail
1114
1118
 
1115
1119
  alias self.raise self.fail