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/hash.rbs CHANGED
@@ -8,7 +8,7 @@
8
8
  #
9
9
  # ### Hash Data Syntax
10
10
  #
11
- # The original syntax for a hash entry uses the "hash rocket," `=>`:
11
+ # The original syntax for a hash entry uses the "hash rocket," <code>=></code>:
12
12
  #
13
13
  # h = {:foo => 0, :bar => 1, :baz => 2}
14
14
  # h # => {foo: 0, bar: 1, baz: 2}
@@ -165,7 +165,7 @@
165
165
  # #### `Hash` Key Equivalence
166
166
  #
167
167
  # Two objects are treated as the same hash key when their `hash` value is
168
- # identical and the two objects are `eql?` to each other.
168
+ # identical and the two objects are <code>eql?</code> to each other.
169
169
  #
170
170
  # #### Modifying an Active `Hash` Key
171
171
  #
@@ -180,7 +180,7 @@
180
180
  # h[a0] # => 0
181
181
  # a0.hash # => 110002110
182
182
  #
183
- # Modifying array element `a0[0]` changes its hash value:
183
+ # Modifying array element <code>a0[0]</code> changes its hash value:
184
184
  #
185
185
  # a0[0] = :bam
186
186
  # a0.hash # => 1069447059
@@ -208,17 +208,17 @@
208
208
  # #### User-Defined `Hash` Keys
209
209
  #
210
210
  # To be usable as a `Hash` key, objects must implement the methods `hash` and
211
- # `eql?`. Note: this requirement does not apply if the `Hash` uses
211
+ # <code>eql?</code>. Note: this requirement does not apply if the `Hash` uses
212
212
  # #compare_by_identity since comparison will then rely on the keys' object id
213
- # instead of `hash` and `eql?`.
213
+ # instead of `hash` and <code>eql?</code>.
214
214
  #
215
- # Object defines basic implementation for `hash` and `eq?` that makes each
216
- # object a distinct key. Typically, user-defined classes will want to override
217
- # these methods to provide meaningful behavior, or for example inherit Struct
218
- # that has useful definitions for these.
215
+ # Object defines basic implementation for `hash` and <code>eq?</code> that makes
216
+ # each object a distinct key. Typically, user-defined classes will want to
217
+ # override these methods to provide meaningful behavior, or for example inherit
218
+ # Struct that has useful definitions for these.
219
219
  #
220
- # A typical implementation of `hash` is based on the object's data while `eql?`
221
- # is usually aliased to the overridden `==` method:
220
+ # A typical implementation of `hash` is based on the object's data while
221
+ # <code>eql?</code> is usually aliased to the overridden <code>==</code> method:
222
222
  #
223
223
  # class Book
224
224
  # attr_reader :author, :title
@@ -263,7 +263,7 @@
263
263
  #
264
264
  # If you want `nil` returned for a not-found key, you can call:
265
265
  #
266
- # * #[](key) (usually written as `#[key]`.
266
+ # * #[](key) (usually written as <code>#[key]</code>.
267
267
  # * #assoc(key).
268
268
  # * #dig(key, *identifiers).
269
269
  # * #values_at(*keys).
@@ -524,10 +524,12 @@ class Hash[unchecked out K, unchecked out V] < Object
524
524
  # -->
525
525
  # If `object` is a hash, returns `object`.
526
526
  #
527
- # Otherwise if `object` responds to `:to_hash`, calls `object.to_hash`; returns
528
- # the result if it is a hash, or raises TypeError if not.
527
+ # Otherwise if `object` responds to <code>:to_hash</code>, calls
528
+ # <code>object.to_hash</code>; returns the result if it is a hash, or raises
529
+ # TypeError if not.
529
530
  #
530
- # Otherwise if `object` does not respond to `:to_hash`, returns `nil`.
531
+ # Otherwise if `object` does not respond to <code>:to_hash</code>, returns
532
+ # `nil`.
531
533
  #
532
534
  def self.try_convert: [U, V] (_ToHash[U, V]) -> ::Hash[U, V]
533
535
  | (untyped) -> (::Hash[untyped, untyped] | nil)
@@ -587,7 +589,7 @@ class Hash[unchecked out K, unchecked out V] < Object
587
589
  #
588
590
  # * `object` is a `Hash` object (or can be converted to one).
589
591
  # * `self` and `object` have the same keys (regardless of order).
590
- # * For each key `key`, `self[key] == object[key]`.
592
+ # * For each key `key`, <code>self[key] == object[key]</code>.
591
593
  #
592
594
  # Otherwise, returns `false`.
593
595
  #
@@ -716,7 +718,7 @@ class Hash[unchecked out K, unchecked out V] < Object
716
718
  # otherwise.
717
719
  #
718
720
  # With argument `entry` and no block, returns `true` if for any key `key`
719
- # `self.assoc(key) == entry`, `false` otherwise:
721
+ # <code>self.assoc(key) == entry</code>, `false` otherwise:
720
722
  #
721
723
  # h = {foo: 0, bar: 1, baz: 2}
722
724
  # h.assoc(:bar) # => [:bar, 1]
@@ -1103,7 +1105,7 @@ class Hash[unchecked out K, unchecked out V] < Object
1103
1105
  #
1104
1106
  # * The given `object` is a `Hash` object.
1105
1107
  # * `self` and `object` have the same keys (regardless of order).
1106
- # * For each key `key`, `self[key].eql?(object[key])`.
1108
+ # * For each key `key`, <code>self[key].eql?(object[key])</code>.
1107
1109
  #
1108
1110
  # Otherwise, returns `false`.
1109
1111
  #
@@ -1232,7 +1234,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1232
1234
  # * Each element whose value is not an array is unchanged. even if the value
1233
1235
  # is an object that has instance method flatten (such as a hash).
1234
1236
  #
1235
- # Examples; note that entry `foo: {bar: 1, baz: 2}` is never flattened.
1237
+ # Examples; note that entry <code>foo: {bar: 1, baz: 2}</code> is never
1238
+ # flattened.
1236
1239
  #
1237
1240
  # h = {foo: {bar: 1, baz: 2}, bat: [:bam, [:bap, [:bah]]]}
1238
1241
  # h.flatten(1) # => [:foo, {:bar=>1, :baz=>2}, :bat, [:bam, [:bap, [:bah]]]]
@@ -1264,7 +1267,7 @@ class Hash[unchecked out K, unchecked out V] < Object
1264
1267
  #
1265
1268
  # Related: [Methods for Querying](rdoc-ref:Hash@Methods+for+Querying).
1266
1269
  #
1267
- def has_key?: (K arg0) -> bool
1270
+ def has_key?: (_Key) -> bool
1268
1271
 
1269
1272
  # <!--
1270
1273
  # rdoc-file=hash.c
@@ -1274,7 +1277,7 @@ class Hash[unchecked out K, unchecked out V] < Object
1274
1277
  #
1275
1278
  # Related: [Methods for Querying](rdoc-ref:Hash@Methods+for+Querying).
1276
1279
  #
1277
- def has_value?: (V arg0) -> bool
1280
+ def has_value?: (top arg0) -> bool
1278
1281
 
1279
1282
  # <!--
1280
1283
  # rdoc-file=hash.c
@@ -1475,8 +1478,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1475
1478
  # With no block given, for each successive entry `key`/`new_value` in each
1476
1479
  # successive `other_hash`:
1477
1480
  #
1478
- # * If `key` is in `self`, sets `self[key] = new_value`, whose position is
1479
- # unchanged:
1481
+ # * If `key` is in `self`, sets <code>self[key] = new_value</code>, whose
1482
+ # position is unchanged:
1480
1483
  #
1481
1484
  # h0 = {foo: 0, bar: 1, baz: 2}
1482
1485
  # h1 = {bar: 3, foo: -1}
@@ -1490,9 +1493,9 @@ class Hash[unchecked out K, unchecked out V] < Object
1490
1493
  # With a block given, for each successive entry `key`/`new_value` in each
1491
1494
  # successive `other_hash`:
1492
1495
  #
1493
- # * If `key` is in `self`, fetches `old_value` from `self[key]`, calls the
1494
- # block with `key`, `old_value`, and `new_value`, and sets `self[key] =
1495
- # new_value`, whose position is unchanged :
1496
+ # * If `key` is in `self`, fetches `old_value` from <code>self[key]</code>,
1497
+ # calls the block with `key`, `old_value`, and `new_value`, and sets
1498
+ # <code>self[key] = new_value</code>, whose position is unchanged :
1496
1499
  #
1497
1500
  # season = {AB: 75, H: 20, HR: 3, SO: 17, W: 11, HBP: 3}
1498
1501
  # today = {AB: 3, H: 1, W: 1}
@@ -1515,8 +1518,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1515
1518
  # rdoc-file=hash.c
1516
1519
  # - rassoc(value) -> new_array or nil
1517
1520
  # -->
1518
- # Searches `self` for the first entry whose value is `==` to the given `value`;
1519
- # see [Entry Order](rdoc-ref:Hash@Entry+Order).
1521
+ # Searches `self` for the first entry whose value is <code>==</code> to the
1522
+ # given `value`; see [Entry Order](rdoc-ref:Hash@Entry+Order).
1520
1523
  #
1521
1524
  # If the entry is found, returns its key and value as a 2-element array; returns
1522
1525
  # `nil` if not found:
@@ -1796,9 +1799,9 @@ class Hash[unchecked out K, unchecked out V] < Object
1796
1799
  # With a block given and no argument, `new_hash` has keys determined only by the
1797
1800
  # block.
1798
1801
  #
1799
- # For each key/value pair `old_key/value` in `self`, calls the block with
1800
- # `old_key`; the block's return value becomes `new_key`; sets `new_hash[new_key]
1801
- # = value`; a duplicate key overwrites:
1802
+ # For each key/value pair <code>old_key/value</code> in `self`, calls the block
1803
+ # with `old_key`; the block's return value becomes `new_key`; sets
1804
+ # <code>new_hash[new_key] = value</code>; a duplicate key overwrites:
1802
1805
  #
1803
1806
  # h = {foo: 0, bar: 1, baz: 2}
1804
1807
  # h.transform_keys {|old_key| old_key.to_s }
@@ -1809,11 +1812,12 @@ class Hash[unchecked out K, unchecked out V] < Object
1809
1812
  # With argument `other_hash` given and no block, `new_hash` may have new keys
1810
1813
  # provided by `other_hash` and unchanged keys provided by `self`.
1811
1814
  #
1812
- # For each key/value pair `old_key/old_value` in `self`, looks for key `old_key`
1813
- # in `other_hash`:
1815
+ # For each key/value pair <code>old_key/old_value</code> in `self`, looks for
1816
+ # key `old_key` in `other_hash`:
1814
1817
  #
1815
- # * If `old_key` is found, its value `other_hash[old_key]` is taken as
1816
- # `new_key`; sets `new_hash[new_key] = value`; a duplicate key overwrites:
1818
+ # * If `old_key` is found, its value <code>other_hash[old_key]</code> is taken
1819
+ # as `new_key`; sets <code>new_hash[new_key] = value</code>; a duplicate key
1820
+ # overwrites:
1817
1821
  #
1818
1822
  # h = {foo: 0, bar: 1, baz: 2}
1819
1823
  # h.transform_keys(baz: :BAZ, bar: :BAR, foo: :FOO)
@@ -1821,8 +1825,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1821
1825
  # h.transform_keys(baz: :FOO, bar: :FOO, foo: :FOO)
1822
1826
  # # => {FOO: 2}
1823
1827
  #
1824
- # * If `old_key` is not found, sets `new_hash[old_key] = value`; a duplicate
1825
- # key overwrites:
1828
+ # * If `old_key` is not found, sets <code>new_hash[old_key] = value</code>; a
1829
+ # duplicate key overwrites:
1826
1830
  #
1827
1831
  # h = {foo: 0, bar: 1, baz: 2}
1828
1832
  # h.transform_keys({})
@@ -1843,16 +1847,16 @@ class Hash[unchecked out K, unchecked out V] < Object
1843
1847
  # For each pair `old_key` and `value` in `self`:
1844
1848
  #
1845
1849
  # * If `other_hash` has key `old_key` (with value `new_key`), does not call
1846
- # the block for that key; sets `new_hash[new_key] = value`; a duplicate key
1847
- # overwrites:
1850
+ # the block for that key; sets <code>new_hash[new_key] = value</code>; a
1851
+ # duplicate key overwrites:
1848
1852
  #
1849
1853
  # h = {foo: 0, bar: 1, baz: 2}
1850
1854
  # h.transform_keys(baz: :BAZ, bar: :BAR, foo: :FOO) {|key| fail 'Not called' }
1851
1855
  # # => {FOO: 0, BAR: 1, BAZ: 2}
1852
1856
  #
1853
1857
  # * If `other_hash` does not have key `old_key`, calls the block with
1854
- # `old_key` and takes its return value as `new_key`; sets `new_hash[new_key]
1855
- # = value`; a duplicate key overwrites:
1858
+ # `old_key` and takes its return value as `new_key`; sets
1859
+ # <code>new_hash[new_key] = value</code>; a duplicate key overwrites:
1856
1860
  #
1857
1861
  # h = {foo: 0, bar: 1, baz: 2}
1858
1862
  # h.transform_keys(baz: :BAZ) {|key| key.to_s.reverse }
@@ -1866,7 +1870,9 @@ class Hash[unchecked out K, unchecked out V] < Object
1866
1870
  # Values](rdoc-ref:Hash@Methods+for+Transforming+Keys+and+Values).
1867
1871
  #
1868
1872
  def transform_keys: () -> Enumerator[K, Hash[untyped, V]]
1873
+ | [A] (Hash[K, A]) -> Hash[A, V]
1869
1874
  | [A] () { (K) -> A } -> Hash[A, V]
1875
+ | [A] (Hash[K, A]) { (K) -> A } -> Hash[A, V]
1870
1876
 
1871
1877
  # <!--
1872
1878
  # rdoc-file=hash.c
@@ -1881,10 +1887,10 @@ class Hash[unchecked out K, unchecked out V] < Object
1881
1887
  # With a block given and no argument, derives keys only from the block; all,
1882
1888
  # some, or none of the keys in `self` may be changed.
1883
1889
  #
1884
- # For each key/value pair `old_key/value` in `self`, calls the block with
1885
- # `old_key`; the block's return value becomes `new_key`; removes the entry for
1886
- # `old_key`: `self.delete(old_key)`; sets `self[new_key] = value`; a duplicate
1887
- # key overwrites:
1890
+ # For each key/value pair <code>old_key/value</code> in `self`, calls the block
1891
+ # with `old_key`; the block's return value becomes `new_key`; removes the entry
1892
+ # for `old_key`: <code>self.delete(old_key)</code>; sets <code>self[new_key] =
1893
+ # value</code>; a duplicate key overwrites:
1888
1894
  #
1889
1895
  # h = {foo: 0, bar: 1, baz: 2}
1890
1896
  # h.transform_keys! {|old_key| old_key.to_s }
@@ -1897,12 +1903,13 @@ class Hash[unchecked out K, unchecked out V] < Object
1897
1903
  # `other_hash` and `self`; all, some, or none of the keys in `self` may be
1898
1904
  # changed.
1899
1905
  #
1900
- # For each key/value pair `old_key/old_value` in `self`, looks for key `old_key`
1901
- # in `other_hash`:
1906
+ # For each key/value pair <code>old_key/old_value</code> in `self`, looks for
1907
+ # key `old_key` in `other_hash`:
1902
1908
  #
1903
- # * If `old_key` is found, takes value `other_hash[old_key]` as `new_key`;
1904
- # removes the entry for `old_key`: `self.delete(old_key)`; sets
1905
- # `self[new_key] = value`; a duplicate key overwrites:
1909
+ # * If `old_key` is found, takes value <code>other_hash[old_key]</code> as
1910
+ # `new_key`; removes the entry for `old_key`:
1911
+ # <code>self.delete(old_key)</code>; sets <code>self[new_key] =
1912
+ # value</code>; a duplicate key overwrites:
1906
1913
  #
1907
1914
  # h = {foo: 0, bar: 1, baz: 2}
1908
1915
  # h.transform_keys!(baz: :BAZ, bar: :BAR, foo: :FOO)
@@ -1933,8 +1940,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1933
1940
  #
1934
1941
  # * If `other_hash` has key `old_key` (with value `new_key`), does not call
1935
1942
  # the block for that key; removes the entry for `old_key`:
1936
- # `self.delete(old_key)`; sets `self[new_key] = value`; a duplicate key
1937
- # overwrites:
1943
+ # <code>self.delete(old_key)</code>; sets <code>self[new_key] =
1944
+ # value</code>; a duplicate key overwrites:
1938
1945
  #
1939
1946
  # h = {foo: 0, bar: 1, baz: 2}
1940
1947
  # h.transform_keys!(baz: :BAZ, bar: :BAR, foo: :FOO) {|key| fail 'Not called' }
@@ -1942,8 +1949,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1942
1949
  #
1943
1950
  # * If `other_hash` does not have key `old_key`, calls the block with
1944
1951
  # `old_key` and takes its return value as `new_key`; removes the entry for
1945
- # `old_key`: `self.delete(old_key)`; sets `self[new_key] = value`; a
1946
- # duplicate key overwrites:
1952
+ # `old_key`: <code>self.delete(old_key)</code>; sets <code>self[new_key] =
1953
+ # value</code>; a duplicate key overwrites:
1947
1954
  #
1948
1955
  # h = {foo: 0, bar: 1, baz: 2}
1949
1956
  # h.transform_keys!(baz: :BAZ) {|key| key.to_s.reverse }
@@ -1958,7 +1965,9 @@ class Hash[unchecked out K, unchecked out V] < Object
1958
1965
  # Values](rdoc-ref:Hash@Methods+for+Transforming+Keys+and+Values).
1959
1966
  #
1960
1967
  def transform_keys!: () -> Enumerator[K, self]
1968
+ | (Hash[K, K]) -> self
1961
1969
  | () { (K) -> K } -> self
1970
+ | (Hash[K, K]) { (K) -> K } -> self
1962
1971
 
1963
1972
  # <!--
1964
1973
  # rdoc-file=hash.c
@@ -1990,7 +1999,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1990
1999
  # returns `self`.
1991
2000
  #
1992
2001
  # For each entry `key`/`old_value` in `self`, calls the block with `old_value`,
1993
- # captures its return value as `new_value`, and sets `self[key] = new_value`:
2002
+ # captures its return value as `new_value`, and sets <code>self[key] =
2003
+ # new_value</code>:
1994
2004
  #
1995
2005
  # h = {foo: 0, bar: 1, baz: 2}
1996
2006
  # h.transform_values! {|value| value * 100} # => {foo: 0, bar: 100, baz: 200}
@@ -2015,8 +2025,8 @@ class Hash[unchecked out K, unchecked out V] < Object
2015
2025
  # With no block given, for each successive entry `key`/`new_value` in each
2016
2026
  # successive `other_hash`:
2017
2027
  #
2018
- # * If `key` is in `self`, sets `self[key] = new_value`, whose position is
2019
- # unchanged:
2028
+ # * If `key` is in `self`, sets <code>self[key] = new_value</code>, whose
2029
+ # position is unchanged:
2020
2030
  #
2021
2031
  # h0 = {foo: 0, bar: 1, baz: 2}
2022
2032
  # h1 = {bar: 3, foo: -1}
@@ -2030,9 +2040,9 @@ class Hash[unchecked out K, unchecked out V] < Object
2030
2040
  # With a block given, for each successive entry `key`/`new_value` in each
2031
2041
  # successive `other_hash`:
2032
2042
  #
2033
- # * If `key` is in `self`, fetches `old_value` from `self[key]`, calls the
2034
- # block with `key`, `old_value`, and `new_value`, and sets `self[key] =
2035
- # new_value`, whose position is unchanged :
2043
+ # * If `key` is in `self`, fetches `old_value` from <code>self[key]</code>,
2044
+ # calls the block with `key`, `old_value`, and `new_value`, and sets
2045
+ # <code>self[key] = new_value</code>, whose position is unchanged :
2036
2046
  #
2037
2047
  # season = {AB: 75, H: 20, HR: 3, SO: 17, W: 11, HBP: 3}
2038
2048
  # today = {AB: 3, H: 1, W: 1}
data/core/integer.rbs CHANGED
@@ -88,7 +88,7 @@
88
88
  # * #downto: Calls the given block with each integer value from `self` down to
89
89
  # the given value.
90
90
  # * #times: Calls the given block `self` times with each integer in
91
- # `(0..self-1)`.
91
+ # <code>(0..self-1)</code>.
92
92
  # * #upto: Calls the given block with each integer value from `self` up to the
93
93
  # given value.
94
94
  #
@@ -114,9 +114,9 @@ class Integer < Numeric
114
114
  # Integer.sqrt(4.0) # => 2
115
115
  # Integer.sqrt(3.14159) # => 1
116
116
  #
117
- # This method is equivalent to `Math.sqrt(numeric).floor`, except that the
118
- # result of the latter code may differ from the true value due to the limited
119
- # precision of floating point arithmetic.
117
+ # This method is equivalent to <code>Math.sqrt(numeric).floor</code>, except
118
+ # that the result of the latter code may differ from the true value due to the
119
+ # limited precision of floating point arithmetic.
120
120
  #
121
121
  # Integer.sqrt(10**46) # => 100000000000000000000000
122
122
  # Math.sqrt(10**46).floor # => 99999999999999991611392
@@ -132,14 +132,15 @@ class Integer < Numeric
132
132
  # If `object` is an Integer object, returns `object`.
133
133
  # Integer.try_convert(1) # => 1
134
134
  #
135
- # Otherwise if `object` responds to `:to_int`, calls `object.to_int` and returns
136
- # the result.
135
+ # Otherwise if `object` responds to <code>:to_int</code>, calls
136
+ # <code>object.to_int</code> and returns the result.
137
137
  # Integer.try_convert(1.25) # => 1
138
138
  #
139
- # Returns `nil` if `object` does not respond to `:to_int`
139
+ # Returns `nil` if `object` does not respond to <code>:to_int</code>
140
140
  # Integer.try_convert([]) # => nil
141
141
  #
142
- # Raises an exception unless `object.to_int` returns an Integer object.
142
+ # Raises an exception unless <code>object.to_int</code> returns an Integer
143
+ # object.
143
144
  #
144
145
  def self.try_convert: (int) -> Integer
145
146
  | (untyped) -> Integer?
@@ -391,7 +392,7 @@ class Integer < Numeric
391
392
  #
392
393
  # Returns:
393
394
  #
394
- # * `-1`, if `self` is less than `other`.
395
+ # * <code>-1</code>, if `self` is less than `other`.
395
396
  # * `0`, if `self` is equal to `other`.
396
397
  # * `1`, if `self` is greater then `other`.
397
398
  # * `nil`, if `self` and `other` are incomparable.
@@ -502,8 +503,8 @@ class Integer < Numeric
502
503
  # n[2] # => 0
503
504
  # n[3] # => 0
504
505
  #
505
- # In principle, `n[i]` is equivalent to `(n >> i) & 1`. Thus, negative index
506
- # always returns zero:
506
+ # In principle, <code>n[i]</code> is equivalent to <code>(n >> i) & 1</code>.
507
+ # Thus, negative index always returns zero:
507
508
  #
508
509
  # 255[-1] # => 0
509
510
  #
@@ -514,8 +515,9 @@ class Integer < Numeric
514
515
  # "%010b" % n[0, 10] # => "0000111000"
515
516
  # "%010b" % n[4, 10] # => "0000000011"
516
517
  #
517
- # With argument `range`, returns `range.size` bits from `self`, beginning at
518
- # `range.begin` and including bits of greater significance:
518
+ # With argument `range`, returns <code>range.size</code> bits from `self`,
519
+ # beginning at <code>range.begin</code> and including bits of greater
520
+ # significance:
519
521
  #
520
522
  # n = 0b111000 # => 56
521
523
  # "%010b" % n[0..9] # => "0000111000"
@@ -611,7 +613,7 @@ class Integer < Numeric
611
613
  # significant bit has bit position 1). If there is no such bit (zero or minus
612
614
  # one), returns zero.
613
615
  #
614
- # This method returns `ceil(log2(self < 0 ? -self : self + 1))`>.
616
+ # This method returns <code>ceil(log2(self < 0 ? -self : self + 1))</code>>.
615
617
  #
616
618
  # (-2**1000-1).bit_length # => 1001
617
619
  # (-2**1000).bit_length # => 1000
@@ -664,7 +666,7 @@ class Integer < Numeric
664
666
  #
665
667
  # * When `self` is non-zero and `ndigits` is negative,
666
668
  # returns a value based on a computed granularity:
667
- # * The granularity is `10 ** ndigits.abs`.
669
+ # * The granularity is <code>10 ** ndigits.abs</code>.
668
670
  # * The returned value is the smallest multiple of the granularity
669
671
  # that is greater than or equal to `self`.
670
672
  # Examples with positive `self`:
@@ -786,7 +788,7 @@ class Integer < Numeric
786
788
  # rdoc-file=numeric.c
787
789
  # - divmod(other) -> array
788
790
  # -->
789
- # Returns a 2-element array `[q, r]`, where
791
+ # Returns a 2-element array <code>[q, r]</code>, where
790
792
  #
791
793
  # q = (self/other).floor # Quotient
792
794
  # r = self % other # Remainder
@@ -875,7 +877,7 @@ class Integer < Numeric
875
877
  #
876
878
  # * When `self` is non-zero and `ndigits` is negative,
877
879
  # returns a value based on a computed granularity:
878
- # * The granularity is `10 ** ndigits.abs`.
880
+ # * The granularity is <code>10 ** ndigits.abs</code>.
879
881
  # * The returned value is the largest multiple of the granularity
880
882
  # that is less than or equal to `self`.
881
883
  # Examples with positive `self`:
@@ -1000,7 +1002,7 @@ class Integer < Numeric
1000
1002
  def negative?: () -> bool
1001
1003
 
1002
1004
  # <!-- rdoc-file=numeric.c -->
1003
- # Returns the successor integer of `self` (equivalent to `self + 1`):
1005
+ # Returns the successor integer of `self` (equivalent to <code>self + 1</code>):
1004
1006
  #
1005
1007
  # 1.succ #=> 2
1006
1008
  # -1.succ #=> 0
@@ -1080,7 +1082,7 @@ class Integer < Numeric
1080
1082
  # rdoc-file=numeric.c
1081
1083
  # - pred -> next_integer
1082
1084
  # -->
1083
- # Returns the predecessor of `self` (equivalent to `self - 1`):
1085
+ # Returns the predecessor of `self` (equivalent to <code>self - 1</code>):
1084
1086
  #
1085
1087
  # 1.pred #=> 0
1086
1088
  # -1.pred #=> -2
@@ -1139,8 +1141,8 @@ class Integer < Numeric
1139
1141
  # Returns `self` rounded to the nearest value with a precision of `ndigits`
1140
1142
  # decimal digits.
1141
1143
  #
1142
- # When `ndigits` is negative, the returned value has at least `ndigits.abs`
1143
- # trailing zeros:
1144
+ # When `ndigits` is negative, the returned value has at least
1145
+ # <code>ndigits.abs</code> trailing zeros:
1144
1146
  #
1145
1147
  # 555.round(-1) # => 560
1146
1148
  # 555.round(-2) # => 600
@@ -1157,17 +1159,18 @@ class Integer < Numeric
1157
1159
  # If keyword argument `half` is given, and `self` is equidistant from the two
1158
1160
  # candidate values, the rounding is according to the given `half` value:
1159
1161
  #
1160
- # * `:up` or `nil`: round away from zero:
1162
+ # * <code>:up</code> or `nil`: round away from zero:
1161
1163
  #
1162
1164
  # 25.round(-1, half: :up) # => 30
1163
1165
  # (-25).round(-1, half: :up) # => -30
1164
1166
  #
1165
- # * `:down`: round toward zero:
1167
+ # * <code>:down</code>: round toward zero:
1166
1168
  #
1167
1169
  # 25.round(-1, half: :down) # => 20
1168
1170
  # (-25).round(-1, half: :down) # => -20
1169
1171
  #
1170
- # * `:even`: round toward the candidate whose last nonzero digit is even:
1172
+ # * <code>:even</code>: round toward the candidate whose last nonzero digit is
1173
+ # even:
1171
1174
  #
1172
1175
  # 25.round(-1, half: :even) # => 20
1173
1176
  # 15.round(-1, half: :even) # => 20
@@ -1200,7 +1203,7 @@ class Integer < Numeric
1200
1203
  # rdoc-file=numeric.c
1201
1204
  # - succ -> next_integer
1202
1205
  # -->
1203
- # Returns the successor integer of `self` (equivalent to `self + 1`):
1206
+ # Returns the successor integer of `self` (equivalent to <code>self + 1</code>):
1204
1207
  #
1205
1208
  # 1.succ #=> 2
1206
1209
  # -1.succ #=> 0
@@ -1214,7 +1217,8 @@ class Integer < Numeric
1214
1217
  # - times {|i| ... } -> self
1215
1218
  # - times -> enumerator
1216
1219
  # -->
1217
- # Calls the given block `self` times with each integer in `(0..self-1)`:
1220
+ # Calls the given block `self` times with each integer in
1221
+ # <code>(0..self-1)</code>:
1218
1222
  #
1219
1223
  # a = []
1220
1224
  # 5.times {|i| a.push(i) } # => 5
@@ -1330,8 +1334,8 @@ class Integer < Numeric
1330
1334
  # Returns `self` truncated (toward zero) to a precision of `ndigits` decimal
1331
1335
  # digits.
1332
1336
  #
1333
- # When `ndigits` is negative, the returned value has at least `ndigits.abs`
1334
- # trailing zeros:
1337
+ # When `ndigits` is negative, the returned value has at least
1338
+ # <code>ndigits.abs</code> trailing zeros:
1335
1339
  #
1336
1340
  # 555.truncate(-1) # => 550
1337
1341
  # 555.truncate(-2) # => 500
data/core/io/buffer.rbs CHANGED
@@ -81,9 +81,9 @@ class IO
81
81
  # File.read('test.txt')
82
82
  # # => "t--- data"
83
83
  #
84
- # **The class is experimental and the interface is subject to change, this is
85
- # especially true of file mappings which may be removed entirely in the
86
- # future.**
84
+ # <strong>The class is experimental and the interface is subject to change, this
85
+ # is especially true of file mappings which may be removed entirely in the
86
+ # future.</strong>
87
87
  #
88
88
  class Buffer
89
89
  include Comparable
@@ -356,7 +356,7 @@ class IO
356
356
  # - get_string([offset, [length, [encoding]]]) -> string
357
357
  # -->
358
358
  # Read a chunk or all of the buffer into a string, in the specified `encoding`.
359
- # If no encoding is provided `Encoding::BINARY` is used.
359
+ # If no encoding is provided <code>Encoding::BINARY</code> is used.
360
360
  #
361
361
  # buffer = IO::Buffer.for('test')
362
362
  # buffer.get_string
@@ -375,32 +375,32 @@ class IO
375
375
  # Read from buffer a value of `type` at `offset`. `buffer_type` should be one of
376
376
  # symbols:
377
377
  #
378
- # * `:U8`: unsigned integer, 1 byte
379
- # * `:S8`: signed integer, 1 byte
380
- # * `:u16`: unsigned integer, 2 bytes, little-endian
381
- # * `:U16`: unsigned integer, 2 bytes, big-endian
382
- # * `:s16`: signed integer, 2 bytes, little-endian
383
- # * `:S16`: signed integer, 2 bytes, big-endian
384
- # * `:u32`: unsigned integer, 4 bytes, little-endian
385
- # * `:U32`: unsigned integer, 4 bytes, big-endian
386
- # * `:s32`: signed integer, 4 bytes, little-endian
387
- # * `:S32`: signed integer, 4 bytes, big-endian
388
- # * `:u64`: unsigned integer, 8 bytes, little-endian
389
- # * `:U64`: unsigned integer, 8 bytes, big-endian
390
- # * `:s64`: signed integer, 8 bytes, little-endian
391
- # * `:S64`: signed integer, 8 bytes, big-endian
392
- # * `:u128`: unsigned integer, 16 bytes, little-endian
393
- # * `:U128`: unsigned integer, 16 bytes, big-endian
394
- # * `:s128`: signed integer, 16 bytes, little-endian
395
- # * `:S128`: signed integer, 16 bytes, big-endian
396
- # * `:f32`: float, 4 bytes, little-endian
397
- # * `:F32`: float, 4 bytes, big-endian
398
- # * `:f64`: double, 8 bytes, little-endian
399
- # * `:F64`: double, 8 bytes, big-endian
378
+ # * <code>:U8</code>: unsigned integer, 1 byte
379
+ # * <code>:S8</code>: signed integer, 1 byte
380
+ # * <code>:u16</code>: unsigned integer, 2 bytes, little-endian
381
+ # * <code>:U16</code>: unsigned integer, 2 bytes, big-endian
382
+ # * <code>:s16</code>: signed integer, 2 bytes, little-endian
383
+ # * <code>:S16</code>: signed integer, 2 bytes, big-endian
384
+ # * <code>:u32</code>: unsigned integer, 4 bytes, little-endian
385
+ # * <code>:U32</code>: unsigned integer, 4 bytes, big-endian
386
+ # * <code>:s32</code>: signed integer, 4 bytes, little-endian
387
+ # * <code>:S32</code>: signed integer, 4 bytes, big-endian
388
+ # * <code>:u64</code>: unsigned integer, 8 bytes, little-endian
389
+ # * <code>:U64</code>: unsigned integer, 8 bytes, big-endian
390
+ # * <code>:s64</code>: signed integer, 8 bytes, little-endian
391
+ # * <code>:S64</code>: signed integer, 8 bytes, big-endian
392
+ # * <code>:u128</code>: unsigned integer, 16 bytes, little-endian
393
+ # * <code>:U128</code>: unsigned integer, 16 bytes, big-endian
394
+ # * <code>:s128</code>: signed integer, 16 bytes, little-endian
395
+ # * <code>:S128</code>: signed integer, 16 bytes, big-endian
396
+ # * <code>:f32</code>: float, 4 bytes, little-endian
397
+ # * <code>:F32</code>: float, 4 bytes, big-endian
398
+ # * <code>:f64</code>: double, 8 bytes, little-endian
399
+ # * <code>:F64</code>: double, 8 bytes, big-endian
400
400
  #
401
401
  # A buffer type refers specifically to the type of binary buffer that is stored
402
- # in the buffer. For example, a `:u32` buffer type is a 32-bit unsigned integer
403
- # in little-endian format.
402
+ # in the buffer. For example, a <code>:u32</code> buffer type is a 32-bit
403
+ # unsigned integer in little-endian format.
404
404
  #
405
405
  # string = [1.5].pack('f')
406
406
  # # => "\x00\x00\xC0?"
@@ -557,7 +557,7 @@ class IO
557
557
  # -->
558
558
  # Read at least `length` bytes from the `io` starting at the specified `from`
559
559
  # position, into the buffer starting at `offset`. If an error occurs, return
560
- # `-errno`.
560
+ # <code>-errno</code>.
561
561
  #
562
562
  # If `length` is not given or `nil`, it defaults to the size of the buffer minus
563
563
  # the offset, i.e. the entire buffer.
@@ -590,7 +590,7 @@ class IO
590
590
  # -->
591
591
  # Write at least `length` bytes from the buffer starting at `offset`, into the
592
592
  # `io` starting at the specified `from` position. If an error occurs, return
593
- # `-errno`.
593
+ # <code>-errno</code>.
594
594
  #
595
595
  # If `length` is not given or `nil`, it defaults to the size of the buffer minus
596
596
  # the offset, i.e. the entire buffer.
@@ -607,7 +607,7 @@ class IO
607
607
  # IO::Buffer.for('1234567').pwrite(out, 2, 3, 1)
608
608
  #
609
609
  # This leads to `234` (3 bytes, starting from position 1) being written into
610
- # `output.txt`, starting from file position 2.
610
+ # <code>output.txt</code>, starting from file position 2.
611
611
  #
612
612
  def pwrite: (untyped, untyped, untyped) -> untyped
613
613
 
@@ -616,7 +616,7 @@ class IO
616
616
  # - read(io, [length, [offset]]) -> read length or -errno
617
617
  # -->
618
618
  # Read at least `length` bytes from the `io`, into the buffer starting at
619
- # `offset`. If an error occurs, return `-errno`.
619
+ # `offset`. If an error occurs, return <code>-errno</code>.
620
620
  #
621
621
  # If `length` is not given or `nil`, it defaults to the size of the buffer minus
622
622
  # the offset, i.e. the entire buffer.
@@ -756,8 +756,8 @@ class IO
756
756
  # minus the specified offset. If the length is negative, it will raise an
757
757
  # ArgumentError.
758
758
  #
759
- # Raises RuntimeError if the `offset+length` is out of the current buffer's
760
- # bounds.
759
+ # Raises RuntimeError if the <code>offset+length</code> is out of the current
760
+ # buffer's bounds.
761
761
  #
762
762
  # string = 'test'
763
763
  # buffer = IO::Buffer.for(string).dup
@@ -841,7 +841,7 @@ class IO
841
841
  # - write(io, [length, [offset]]) -> written length or -errno
842
842
  # -->
843
843
  # Write at least `length` bytes from the buffer starting at `offset`, into the
844
- # `io`. If an error occurs, return `-errno`.
844
+ # `io`. If an error occurs, return <code>-errno</code>.
845
845
  #
846
846
  # If `length` is not given or `nil`, it defaults to the size of the buffer minus
847
847
  # the offset, i.e. the entire buffer.
@@ -854,7 +854,7 @@ class IO
854
854
  # out = File.open('output.txt', 'wb')
855
855
  # IO::Buffer.for('1234567').write(out, 3)
856
856
  #
857
- # This leads to `123` being written into `output.txt`
857
+ # This leads to `123` being written into <code>output.txt</code>
858
858
  #
859
859
  def write: (untyped, untyped) -> untyped
860
860