rbs 4.0.0.dev.5 → 4.0.1.dev.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 (194) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +1 -0
  3. data/.github/workflows/c-check.yml +8 -4
  4. data/.github/workflows/comments.yml +3 -1
  5. data/.github/workflows/dependabot.yml +1 -1
  6. data/.github/workflows/ruby.yml +10 -0
  7. data/.github/workflows/rust.yml +95 -0
  8. data/CHANGELOG.md +323 -0
  9. data/Rakefile +12 -29
  10. data/Steepfile +1 -0
  11. data/config.yml +393 -37
  12. data/core/array.rbs +218 -188
  13. data/core/basic_object.rbs +9 -8
  14. data/core/class.rbs +6 -5
  15. data/core/comparable.rbs +45 -31
  16. data/core/complex.rbs +52 -40
  17. data/core/dir.rbs +57 -45
  18. data/core/encoding.rbs +5 -5
  19. data/core/enumerable.rbs +96 -91
  20. data/core/enumerator.rbs +4 -3
  21. data/core/errno.rbs +3 -2
  22. data/core/errors.rbs +31 -29
  23. data/core/exception.rbs +12 -12
  24. data/core/fiber.rbs +36 -36
  25. data/core/file.rbs +186 -113
  26. data/core/file_test.rbs +2 -2
  27. data/core/float.rbs +41 -32
  28. data/core/gc.rbs +78 -70
  29. data/core/hash.rbs +70 -60
  30. data/core/integer.rbs +32 -28
  31. data/core/io/buffer.rbs +36 -36
  32. data/core/io/wait.rbs +7 -7
  33. data/core/io.rbs +120 -135
  34. data/core/kernel.rbs +189 -139
  35. data/core/marshal.rbs +3 -3
  36. data/core/match_data.rbs +14 -12
  37. data/core/math.rbs +69 -67
  38. data/core/method.rbs +6 -6
  39. data/core/module.rbs +146 -85
  40. data/core/nil_class.rbs +4 -3
  41. data/core/numeric.rbs +35 -32
  42. data/core/object.rbs +6 -8
  43. data/core/object_space.rbs +11 -10
  44. data/core/pathname.rbs +131 -81
  45. data/core/proc.rbs +65 -33
  46. data/core/process.rbs +219 -201
  47. data/core/ractor.rbs +15 -11
  48. data/core/random.rbs +4 -3
  49. data/core/range.rbs +52 -47
  50. data/core/rational.rbs +5 -5
  51. data/core/rbs/unnamed/argf.rbs +58 -51
  52. data/core/rbs/unnamed/env_class.rbs +18 -13
  53. data/core/rbs/unnamed/main_class.rbs +123 -0
  54. data/core/rbs/unnamed/random.rbs +7 -5
  55. data/core/regexp.rbs +236 -197
  56. data/core/ruby.rbs +1 -1
  57. data/core/ruby_vm.rbs +32 -30
  58. data/core/rubygems/config_file.rbs +5 -5
  59. data/core/rubygems/errors.rbs +1 -1
  60. data/core/rubygems/requirement.rbs +5 -5
  61. data/core/rubygems/rubygems.rbs +5 -3
  62. data/core/set.rbs +17 -16
  63. data/core/signal.rbs +2 -2
  64. data/core/string.rbs +311 -292
  65. data/core/struct.rbs +26 -25
  66. data/core/symbol.rbs +25 -24
  67. data/core/thread.rbs +40 -34
  68. data/core/time.rbs +47 -42
  69. data/core/trace_point.rbs +34 -31
  70. data/core/true_class.rbs +2 -2
  71. data/core/unbound_method.rbs +10 -10
  72. data/core/warning.rbs +7 -7
  73. data/docs/collection.md +1 -1
  74. data/docs/config.md +171 -0
  75. data/docs/inline.md +110 -4
  76. data/docs/syntax.md +13 -12
  77. data/ext/rbs_extension/ast_translation.c +489 -135
  78. data/ext/rbs_extension/class_constants.c +8 -0
  79. data/ext/rbs_extension/class_constants.h +4 -0
  80. data/ext/rbs_extension/legacy_location.c +28 -51
  81. data/ext/rbs_extension/legacy_location.h +37 -0
  82. data/ext/rbs_extension/main.c +12 -20
  83. data/include/rbs/ast.h +423 -195
  84. data/include/rbs/lexer.h +2 -2
  85. data/include/rbs/location.h +25 -44
  86. data/include/rbs/parser.h +2 -2
  87. data/include/rbs/util/rbs_constant_pool.h +0 -3
  88. data/include/rbs.h +8 -0
  89. data/lib/rbs/ast/ruby/annotations.rb +157 -4
  90. data/lib/rbs/ast/ruby/members.rb +374 -22
  91. data/lib/rbs/cli/validate.rb +5 -60
  92. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  93. data/lib/rbs/definition_builder.rb +60 -27
  94. data/lib/rbs/errors.rb +0 -11
  95. data/lib/rbs/inline_parser.rb +1 -1
  96. data/lib/rbs/parser_aux.rb +20 -7
  97. data/lib/rbs/prototype/helpers.rb +57 -0
  98. data/lib/rbs/prototype/rb.rb +1 -26
  99. data/lib/rbs/prototype/rbi.rb +1 -20
  100. data/lib/rbs/test/type_check.rb +3 -0
  101. data/lib/rbs/types.rb +62 -52
  102. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  103. data/lib/rbs/version.rb +1 -1
  104. data/lib/rbs.rb +0 -1
  105. data/rbs.gemspec +1 -1
  106. data/rust/.gitignore +1 -0
  107. data/rust/Cargo.lock +378 -0
  108. data/rust/Cargo.toml +7 -0
  109. data/rust/ruby-rbs/Cargo.toml +22 -0
  110. data/rust/ruby-rbs/build.rs +764 -0
  111. data/rust/ruby-rbs/examples/locations.rs +60 -0
  112. data/rust/ruby-rbs/src/lib.rs +1 -0
  113. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  114. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  115. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  116. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  117. data/rust/ruby-rbs-sys/build.rs +204 -0
  118. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  119. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  120. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  121. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  122. data/sig/ast/ruby/annotations.rbs +191 -4
  123. data/sig/ast/ruby/members.rbs +21 -1
  124. data/sig/cli/validate.rbs +1 -6
  125. data/sig/definition_builder.rbs +2 -0
  126. data/sig/errors.rbs +0 -8
  127. data/sig/method_types.rbs +1 -1
  128. data/sig/parser.rbs +17 -13
  129. data/sig/prototype/helpers.rbs +2 -0
  130. data/sig/types.rbs +10 -11
  131. data/sig/unit_test/spy.rbs +0 -8
  132. data/sig/unit_test/type_assertions.rbs +11 -0
  133. data/src/ast.c +339 -161
  134. data/src/lexstate.c +1 -1
  135. data/src/location.c +7 -47
  136. data/src/parser.c +674 -480
  137. data/src/util/rbs_constant_pool.c +0 -4
  138. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  139. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  140. data/stdlib/coverage/0/coverage.rbs +4 -3
  141. data/stdlib/date/0/date.rbs +33 -28
  142. data/stdlib/date/0/date_time.rbs +24 -23
  143. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  144. data/stdlib/erb/0/erb.rbs +64 -53
  145. data/stdlib/etc/0/etc.rbs +55 -50
  146. data/stdlib/fileutils/0/fileutils.rbs +138 -125
  147. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  148. data/stdlib/io-console/0/io-console.rbs +2 -2
  149. data/stdlib/json/0/json.rbs +135 -108
  150. data/stdlib/monitor/0/monitor.rbs +3 -3
  151. data/stdlib/net-http/0/net-http.rbs +159 -134
  152. data/stdlib/objspace/0/objspace.rbs +8 -7
  153. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  154. data/stdlib/open3/0/open3.rbs +36 -35
  155. data/stdlib/openssl/0/openssl.rbs +144 -129
  156. data/stdlib/optparse/0/optparse.rbs +18 -14
  157. data/stdlib/pathname/0/pathname.rbs +2 -2
  158. data/stdlib/pp/0/pp.rbs +9 -8
  159. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  160. data/stdlib/pstore/0/pstore.rbs +35 -30
  161. data/stdlib/psych/0/psych.rbs +61 -8
  162. data/stdlib/psych/0/store.rbs +2 -4
  163. data/stdlib/pty/0/pty.rbs +9 -6
  164. data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
  165. data/stdlib/ripper/0/ripper.rbs +20 -17
  166. data/stdlib/securerandom/0/securerandom.rbs +1 -1
  167. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  168. data/stdlib/socket/0/addrinfo.rbs +7 -7
  169. data/stdlib/socket/0/basic_socket.rbs +3 -3
  170. data/stdlib/socket/0/ip_socket.rbs +10 -8
  171. data/stdlib/socket/0/socket.rbs +10 -9
  172. data/stdlib/socket/0/tcp_server.rbs +1 -1
  173. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  174. data/stdlib/socket/0/udp_socket.rbs +1 -1
  175. data/stdlib/socket/0/unix_server.rbs +1 -1
  176. data/stdlib/stringio/0/stringio.rbs +55 -54
  177. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  178. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  179. data/stdlib/time/0/time.rbs +7 -5
  180. data/stdlib/tsort/0/tsort.rbs +7 -6
  181. data/stdlib/uri/0/common.rbs +26 -18
  182. data/stdlib/uri/0/file.rbs +2 -2
  183. data/stdlib/uri/0/generic.rbs +2 -2
  184. data/stdlib/uri/0/http.rbs +2 -2
  185. data/stdlib/uri/0/ldap.rbs +2 -2
  186. data/stdlib/uri/0/mailto.rbs +3 -3
  187. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  188. data/stdlib/zlib/0/deflate.rbs +4 -3
  189. data/stdlib/zlib/0/gzip_reader.rbs +4 -4
  190. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  191. data/stdlib/zlib/0/inflate.rbs +1 -1
  192. data/stdlib/zlib/0/need_dict.rbs +1 -1
  193. metadata +23 -5
  194. data/.github/workflows/valgrind.yml +0 -42
data/core/ractor.rbs CHANGED
@@ -96,8 +96,9 @@
96
96
  # object.
97
97
  #
98
98
  # Deep cloning of objects may be slow, and sometimes impossible. Alternatively,
99
- # `move: true` may be used during sending. This will *move* the unshareable
100
- # object to the receiving ractor, making it inaccessible to the sending ractor.
99
+ # <code>move: true</code> may be used during sending. This will *move* the
100
+ # unshareable object to the receiving ractor, making it inaccessible to the
101
+ # sending ractor.
101
102
  #
102
103
  # data = ['foo', 'bar']
103
104
  # r = Ractor.new do
@@ -171,8 +172,8 @@
171
172
  # # I see C
172
173
  # # can not access instance variables of classes/modules from non-main Ractors (RuntimeError)
173
174
  #
174
- # See also the description of `# shareable_constant_value` pragma in [Comments
175
- # syntax](rdoc-ref:syntax/comments.rdoc) explanation.
175
+ # See also the description of <code># shareable_constant_value</code> pragma in
176
+ # [Comments syntax](rdoc-ref:syntax/comments.rdoc) explanation.
176
177
  #
177
178
  # ## Ractors vs threads
178
179
  #
@@ -392,9 +393,10 @@ class Ractor
392
393
  # # r1 done
393
394
  # # r0 done
394
395
  #
395
- # The following example is almost equivalent to `ractors.map(&:value)` except
396
- # the thread is unblocked when any of the ractors has terminated as opposed to
397
- # waiting for their termination in the array element order.
396
+ # The following example is almost equivalent to
397
+ # <code>ractors.map(&:value)</code> except the thread is unblocked when any of
398
+ # the ractors has terminated as opposed to waiting for their termination in the
399
+ # array element order.
398
400
  #
399
401
  # values = []
400
402
  # until ractors.empty?
@@ -425,8 +427,8 @@ class Ractor
425
427
  # - Ractor.shareable_proc(self: nil){} -> shareable proc
426
428
  # -->
427
429
  # Returns a shareable copy of the given block's Proc. The value of `self` in the
428
- # Proc will be replaced with the value passed via the `self:` keyword, or `nil`
429
- # if not given.
430
+ # Proc will be replaced with the value passed via the <code>self:</code>
431
+ # keyword, or `nil` if not given.
430
432
  #
431
433
  # In a shareable Proc, access to any outer variables if prohibited.
432
434
  #
@@ -539,8 +541,10 @@ class Ractor
539
541
  # Registers the port as a monitoring port for this ractor. When the ractor
540
542
  # terminates, the port receives a Symbol object.
541
543
  #
542
- # * `:exited` is sent if the ractor terminates without an unhandled exception.
543
- # * `:aborted` is sent if the ractor terminates by an unhandled exception.
544
+ # * <code>:exited</code> is sent if the ractor terminates without an unhandled
545
+ # exception.
546
+ # * <code>:aborted</code> is sent if the ractor terminates by an unhandled
547
+ # exception.
544
548
  #
545
549
  # r = Ractor.new{ some_task() }
546
550
  # r.monitor(port = Ractor::Port.new)
data/core/random.rbs CHANGED
@@ -190,9 +190,10 @@ end
190
190
  # <!-- rdoc-file=lib/random/formatter.rb -->
191
191
  # ## Random number formatter.
192
192
  #
193
- # Formats generated random numbers in many manners. When `'random/formatter'` is
194
- # required, several methods are added to empty core module `Random::Formatter`,
195
- # making them available as Random's instance and module methods.
193
+ # Formats generated random numbers in many manners. When
194
+ # <code>'random/formatter'</code> is required, several methods are added to
195
+ # empty core module <code>Random::Formatter</code>, making them available as
196
+ # Random's instance and module methods.
196
197
  #
197
198
  # Standard library SecureRandom is also extended with the module, and the
198
199
  # methods described below are available as a module methods in it.
data/core/range.rbs CHANGED
@@ -98,8 +98,9 @@
98
98
  # ## Ranges and Other Classes
99
99
  #
100
100
  # An object may be put into a range if its class implements instance method
101
- # `#<=>`. Ruby core classes that do so include Array, Complex, File::Stat,
102
- # Float, Integer, Kernel, Module, Numeric, Rational, String, Symbol, and Time.
101
+ # <code>#<=></code>. Ruby core classes that do so include Array, Complex,
102
+ # File::Stat, Float, Integer, Kernel, Module, Numeric, Rational, String, Symbol,
103
+ # and Time.
103
104
  #
104
105
  # Example:
105
106
  #
@@ -128,12 +129,13 @@
128
129
  # ## Ranges and User-Defined Classes
129
130
  #
130
131
  # A user-defined class that is to be used in a range must implement instance
131
- # method `#<=>`; see Integer#<=>. To make iteration available, it must also
132
- # implement instance method `succ`; see Integer#succ.
132
+ # method <code>#<=></code>; see Integer#<=>. To make iteration available, it
133
+ # must also implement instance method `succ`; see Integer#succ.
133
134
  #
134
- # The class below implements both `#<=>` and `succ`, and so can be used both to
135
- # construct ranges and to iterate over them. Note that the Comparable module is
136
- # included so the `==` method is defined in terms of `#<=>`.
135
+ # The class below implements both <code>#<=></code> and `succ`, and so can be
136
+ # used both to construct ranges and to iterate over them. Note that the
137
+ # Comparable module is included so the <code>==</code> method is defined in
138
+ # terms of <code>#<=></code>.
137
139
  #
138
140
  # # Represent a string of 'X' characters.
139
141
  # class Xs
@@ -268,9 +270,9 @@ class Range[out Elem] < Object
268
270
  # Returns `true` if and only if:
269
271
  #
270
272
  # * `other` is a range.
271
- # * `other.begin == self.begin`.
272
- # * `other.end == self.end`.
273
- # * `other.exclude_end? == self.exclude_end?`.
273
+ # * <code>other.begin == self.begin</code>.
274
+ # * <code>other.end == self.end</code>.
275
+ # * <code>other.exclude_end? == self.exclude_end?</code>.
274
276
  #
275
277
  # Otherwise returns `false`.
276
278
  #
@@ -297,8 +299,8 @@ class Range[out Elem] < Object
297
299
  # rdoc-file=range.c
298
300
  # - self === object -> true or false
299
301
  # -->
300
- # Returns `true` if `object` is between `self.begin` and `self.end`. `false`
301
- # otherwise:
302
+ # Returns `true` if `object` is between <code>self.begin</code> and
303
+ # <code>self.end</code>. `false` otherwise:
302
304
  #
303
305
  # (1..4) === 2 # => true
304
306
  # (1..4) === 5 # => false
@@ -308,7 +310,7 @@ class Range[out Elem] < Object
308
310
  # ('a'..'d') === 'c' # => true
309
311
  # ('a'..'d') === 'e' # => false
310
312
  #
311
- # A case statement uses method `===`, and so:
313
+ # A case statement uses method <code>===</code>, and so:
312
314
  #
313
315
  # case 79
314
316
  # when (1..50)
@@ -364,10 +366,11 @@ class Range[out Elem] < Object
364
366
  # -->
365
367
  # Returns `true` if the given argument is within `self`, `false` otherwise.
366
368
  #
367
- # With non-range argument `object`, evaluates with `<=` and `<`.
369
+ # With non-range argument `object`, evaluates with <code><=</code> and
370
+ # <code><</code>.
368
371
  #
369
- # For range `self` with included end value (`#exclude_end? == false`), evaluates
370
- # thus:
372
+ # For range `self` with included end value (<code>#exclude_end? ==
373
+ # false</code>), evaluates thus:
371
374
  #
372
375
  # self.begin <= object <= self.end
373
376
  #
@@ -387,8 +390,8 @@ class Range[out Elem] < Object
387
390
  # r.cover?('e') # => false
388
391
  # r.cover?(0) # => false
389
392
  #
390
- # For range `r` with excluded end value (`#exclude_end? == true`), evaluates
391
- # thus:
393
+ # For range `r` with excluded end value (<code>#exclude_end? == true</code>),
394
+ # evaluates thus:
392
395
  #
393
396
  # r.begin <= object < r.end
394
397
  #
@@ -434,8 +437,8 @@ class Range[out Elem] < Object
434
437
  # Returns `false` if either:
435
438
  #
436
439
  # * The begin value of `self` is larger than its end value.
437
- # * An internal call to `#<=>` returns `nil`; that is, the operands are not
438
- # comparable.
440
+ # * An internal call to <code>#<=></code> returns `nil`; that is, the operands
441
+ # are not comparable.
439
442
  #
440
443
  # Beginless ranges cover all values of the same type before the end, excluding
441
444
  # the end for exclusive ranges. Beginless ranges cover ranges that end before
@@ -493,7 +496,7 @@ class Range[out Elem] < Object
493
496
  # (1..4).each {|element| a.push(element) } # => 1..4
494
497
  # a # => [1, 2, 3, 4]
495
498
  #
496
- # Raises an exception unless `self.first.respond_to?(:succ)`.
499
+ # Raises an exception unless <code>self.first.respond_to?(:succ)</code>.
497
500
  #
498
501
  # With no block given, returns an enumerator.
499
502
  #
@@ -556,7 +559,7 @@ class Range[out Elem] < Object
556
559
  # - hash -> integer
557
560
  # -->
558
561
  # Returns the integer hash value for `self`. Two range objects `r0` and `r1`
559
- # have the same hash value if and only if `r0.eql?(r1)`.
562
+ # have the same hash value if and only if <code>r0.eql?(r1)</code>.
560
563
  #
561
564
  # Related: Range#eql?, Object#hash.
562
565
  #
@@ -608,8 +611,8 @@ class Range[out Elem] < Object
608
611
  # rdoc-file=range.c
609
612
  # - inspect -> string
610
613
  # -->
611
- # Returns a string representation of `self`, including `begin.inspect` and
612
- # `end.inspect`:
614
+ # Returns a string representation of `self`, including
615
+ # <code>begin.inspect</code> and <code>end.inspect</code>:
613
616
  #
614
617
  # (1..4).inspect # => "1..4"
615
618
  # (1...4).inspect # => "1...4"
@@ -668,8 +671,8 @@ class Range[out Elem] < Object
668
671
  # - max {|a, b| ... } -> object
669
672
  # - max(n) {|a, b| ... } -> array
670
673
  # -->
671
- # Returns the maximum value in `self`, using method `#<=>` or a given block for
672
- # comparison.
674
+ # Returns the maximum value in `self`, using method <code>#<=></code> or a given
675
+ # block for comparison.
673
676
  #
674
677
  # With no argument and no block given, returns the maximum-valued element of
675
678
  # `self`.
@@ -736,7 +739,7 @@ class Range[out Elem] < Object
736
739
  #
737
740
  # Raises an exception if either:
738
741
  #
739
- # * `self` is a endless range: `(1..)`.
742
+ # * `self` is a endless range: <code>(1..)</code>.
740
743
  # * A block is given and `self` is a beginless range.
741
744
  #
742
745
  # Related: Range#min, Range#minmax.
@@ -750,8 +753,8 @@ class Range[out Elem] < Object
750
753
  # - min {|a, b| ... } -> object
751
754
  # - min(n) {|a, b| ... } -> array
752
755
  # -->
753
- # Returns the minimum value in `self`, using method `#<=>` or a given block for
754
- # comparison.
756
+ # Returns the minimum value in `self`, using method <code>#<=></code> or a given
757
+ # block for comparison.
755
758
  #
756
759
  # With no argument and no block given, returns the minimum-valued element of
757
760
  # `self`.
@@ -818,7 +821,7 @@ class Range[out Elem] < Object
818
821
  #
819
822
  # Raises an exception if either:
820
823
  #
821
- # * `self` is a beginless range: `(..4)`.
824
+ # * `self` is a beginless range: <code>(..4)</code>.
822
825
  # * A block is given and `self` is an endless range.
823
826
  #
824
827
  # Related: Range#max, Range#minmax.
@@ -831,10 +834,10 @@ class Range[out Elem] < Object
831
834
  # - minmax {|a, b| ... } -> [object, object]
832
835
  # -->
833
836
  # Returns a 2-element array containing the minimum and maximum value in `self`,
834
- # either according to comparison method `#<=>` or a given block.
837
+ # either according to comparison method <code>#<=></code> or a given block.
835
838
  #
836
- # With no block given, returns the minimum and maximum values, using `#<=>` for
837
- # comparison:
839
+ # With no block given, returns the minimum and maximum values, using
840
+ # <code>#<=></code> for comparison:
838
841
  #
839
842
  # (1..4).minmax # => [1, 4]
840
843
  # (1...4).minmax # => [1, 3]
@@ -847,12 +850,13 @@ class Range[out Elem] < Object
847
850
  # * Zero if `a` and `b` are equal.
848
851
  # * Positive if `a` is larger than `b`.
849
852
  #
850
- # The block is called `self.size` times to compare elements; returns a 2-element
851
- # Array containing the minimum and maximum values from `self`, per the block:
853
+ # The block is called <code>self.size</code> times to compare elements; returns
854
+ # a 2-element Array containing the minimum and maximum values from `self`, per
855
+ # the block:
852
856
  #
853
857
  # (1..4).minmax {|a, b| -(a <=> b) } # => [4, 1]
854
858
  #
855
- # Returns `[nil, nil]` if:
859
+ # Returns <code>[nil, nil]</code> if:
856
860
  #
857
861
  # * The begin value of the range is larger than the end value:
858
862
  #
@@ -884,8 +888,8 @@ class Range[out Elem] < Object
884
888
  #
885
889
  # (1..3).overlap?(1) # TypeError
886
890
  #
887
- # Returns `false` if an internal call to `#<=>` returns `nil`; that is, the
888
- # operands are not comparable.
891
+ # Returns `false` if an internal call to <code>#<=></code> returns `nil`; that
892
+ # is, the operands are not comparable.
889
893
  #
890
894
  # (1..3).overlap?('a'..'d') # => false
891
895
  #
@@ -929,7 +933,8 @@ class Range[out Elem] < Object
929
933
  # (...[]).overlap?(...[]) # => true
930
934
  #
931
935
  # Even if those ranges are effectively empty (no number can be smaller than
932
- # `-Float::INFINITY`), they are still considered overlapping with themselves.
936
+ # <code>-Float::INFINITY</code>), they are still considered overlapping with
937
+ # themselves.
933
938
  #
934
939
  # Related: Range#cover?.
935
940
  #
@@ -1019,7 +1024,7 @@ class Range[out Elem] < Object
1019
1024
  # - step(s = 1) -> enumerator/arithmetic_sequence
1020
1025
  # -->
1021
1026
  # Iterates over the elements of range in steps of `s`. The iteration is
1022
- # performed by `+` operator:
1027
+ # performed by <code>+</code> operator:
1023
1028
  #
1024
1029
  # (0..6).step(2) { puts _1 } #=> 1..5
1025
1030
  # # Prints: 0, 2, 4, 6
@@ -1034,8 +1039,8 @@ class Range[out Elem] < Object
1034
1039
  # # 2022-02-28 00:00:00 UTC
1035
1040
  # # 2022-03-01 00:00:00 UTC
1036
1041
  #
1037
- # If ` + step` decreases the value, iteration is still performed when step
1038
- # `begin` is higher than the `end`:
1042
+ # If <code> + step</code> decreases the value, iteration is still performed when
1043
+ # step `begin` is higher than the `end`:
1039
1044
  #
1040
1045
  # (0..6).step(-2) { puts _1 }
1041
1046
  # # Prints nothing
@@ -1100,8 +1105,8 @@ class Range[out Elem] < Object
1100
1105
  # rdoc-file=range.c
1101
1106
  # - to_s -> string
1102
1107
  # -->
1103
- # Returns a string representation of `self`, including `begin.to_s` and
1104
- # `end.to_s`:
1108
+ # Returns a string representation of `self`, including <code>begin.to_s</code>
1109
+ # and <code>end.to_s</code>:
1105
1110
  #
1106
1111
  # (1..4).to_s # => "1..4"
1107
1112
  # (1...4).to_s # => "1...4"
@@ -1124,9 +1129,9 @@ class Range[out Elem] < Object
1124
1129
  # Returns `true` if and only if:
1125
1130
  #
1126
1131
  # * `other` is a range.
1127
- # * `other.begin.eql?(self.begin)`.
1128
- # * `other.end.eql?(self.end)`.
1129
- # * `other.exclude_end? == self.exclude_end?`.
1132
+ # * <code>other.begin.eql?(self.begin)</code>.
1133
+ # * <code>other.end.eql?(self.end)</code>.
1134
+ # * <code>other.exclude_end? == self.exclude_end?</code>.
1130
1135
  #
1131
1136
  # Otherwise returns `false`.
1132
1137
  #
data/core/rational.rbs CHANGED
@@ -161,7 +161,7 @@ class Rational < Numeric
161
161
  #
162
162
  # Returns:
163
163
  #
164
- # * `-1`, if `self` is less than `other`.
164
+ # * <code>-1</code>, if `self` is less than `other`.
165
165
  # * `0`, if the two values are the same.
166
166
  # * `1`, if `self` is greater than `other`.
167
167
  # * `nil`, if the two values are incomparable.
@@ -216,7 +216,7 @@ class Rational < Numeric
216
216
  # `ndigits` decimal digits (default: 0).
217
217
  #
218
218
  # When the precision is negative, the returned value is an integer with at least
219
- # `ndigits.abs` trailing zeros.
219
+ # <code>ndigits.abs</code> trailing zeros.
220
220
  #
221
221
  # Returns a rational when `ndigits` is positive, otherwise returns an integer.
222
222
  #
@@ -272,7 +272,7 @@ class Rational < Numeric
272
272
  # `ndigits` decimal digits (default: 0).
273
273
  #
274
274
  # When the precision is negative, the returned value is an integer with at least
275
- # `ndigits.abs` trailing zeros.
275
+ # <code>ndigits.abs</code> trailing zeros.
276
276
  #
277
277
  # Returns a rational when `ndigits` is positive, otherwise returns an integer.
278
278
  #
@@ -392,7 +392,7 @@ class Rational < Numeric
392
392
  # decimal digits (default: 0).
393
393
  #
394
394
  # When the precision is negative, the returned value is an integer with at least
395
- # `ndigits.abs` trailing zeros.
395
+ # <code>ndigits.abs</code> trailing zeros.
396
396
  #
397
397
  # Returns a rational when `ndigits` is positive, otherwise returns an integer.
398
398
  #
@@ -482,7 +482,7 @@ class Rational < Numeric
482
482
  # digits (default: 0).
483
483
  #
484
484
  # When the precision is negative, the returned value is an integer with at least
485
- # `ndigits.abs` trailing zeros.
485
+ # <code>ndigits.abs</code> trailing zeros.
486
486
  #
487
487
  # Returns a rational when `ndigits` is positive, otherwise returns an integer.
488
488
  #