rbs 3.10.4 → 4.0.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 (267) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +14 -14
  3. data/.github/workflows/bundle-update.yml +60 -0
  4. data/.github/workflows/c-check.yml +7 -5
  5. data/.github/workflows/comments.yml +2 -2
  6. data/.github/workflows/dependabot.yml +2 -2
  7. data/.github/workflows/ruby.yml +16 -26
  8. data/.github/workflows/rust.yml +95 -0
  9. data/.github/workflows/typecheck.yml +1 -1
  10. data/.github/workflows/windows.yml +2 -2
  11. data/.rubocop.yml +2 -2
  12. data/.vscode/extensions.json +5 -0
  13. data/.vscode/settings.json +19 -0
  14. data/CHANGELOG.md +202 -2
  15. data/Rakefile +9 -23
  16. data/Steepfile +2 -0
  17. data/config.yml +457 -13
  18. data/core/array.rbs +218 -188
  19. data/core/basic_object.rbs +9 -8
  20. data/core/binding.rbs +0 -2
  21. data/core/builtin.rbs +2 -2
  22. data/core/class.rbs +6 -5
  23. data/core/comparable.rbs +45 -31
  24. data/core/complex.rbs +66 -55
  25. data/core/dir.rbs +57 -45
  26. data/core/encoding.rbs +6 -6
  27. data/core/enumerable.rbs +105 -91
  28. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  29. data/core/enumerator.rbs +24 -3
  30. data/core/errno.rbs +3 -2
  31. data/core/errors.rbs +31 -29
  32. data/core/exception.rbs +12 -12
  33. data/core/fiber.rbs +47 -36
  34. data/core/file.rbs +242 -169
  35. data/core/file_test.rbs +2 -2
  36. data/core/float.rbs +42 -68
  37. data/core/gc.rbs +78 -70
  38. data/core/hash.rbs +70 -60
  39. data/core/integer.rbs +32 -75
  40. data/core/io/buffer.rbs +36 -36
  41. data/core/io/wait.rbs +7 -7
  42. data/core/io.rbs +192 -146
  43. data/core/kernel.rbs +198 -147
  44. data/core/marshal.rbs +3 -3
  45. data/core/match_data.rbs +14 -12
  46. data/core/math.rbs +69 -67
  47. data/core/method.rbs +6 -8
  48. data/core/module.rbs +148 -88
  49. data/core/nil_class.rbs +4 -3
  50. data/core/numeric.rbs +53 -50
  51. data/core/object.rbs +6 -8
  52. data/core/object_space.rbs +11 -10
  53. data/core/pathname.rbs +131 -81
  54. data/core/proc.rbs +65 -34
  55. data/core/process.rbs +221 -201
  56. data/core/ractor.rbs +15 -11
  57. data/core/random.rbs +21 -3
  58. data/core/range.rbs +152 -49
  59. data/core/rational.rbs +5 -56
  60. data/core/rbs/unnamed/argf.rbs +58 -51
  61. data/core/rbs/unnamed/env_class.rbs +18 -13
  62. data/core/rbs/unnamed/main_class.rbs +123 -0
  63. data/core/rbs/unnamed/random.rbs +7 -116
  64. data/core/regexp.rbs +236 -197
  65. data/core/ruby.rbs +1 -1
  66. data/core/ruby_vm.rbs +32 -30
  67. data/core/rubygems/config_file.rbs +5 -5
  68. data/core/rubygems/errors.rbs +1 -1
  69. data/core/rubygems/requirement.rbs +5 -5
  70. data/core/rubygems/rubygems.rbs +5 -3
  71. data/core/set.rbs +17 -16
  72. data/core/signal.rbs +2 -2
  73. data/core/string.rbs +318 -298
  74. data/core/struct.rbs +26 -25
  75. data/core/symbol.rbs +25 -24
  76. data/core/thread.rbs +40 -41
  77. data/core/time.rbs +47 -42
  78. data/core/trace_point.rbs +34 -31
  79. data/core/true_class.rbs +2 -2
  80. data/core/unbound_method.rbs +10 -10
  81. data/core/warning.rbs +7 -7
  82. data/docs/collection.md +1 -1
  83. data/docs/config.md +171 -0
  84. data/docs/inline.md +576 -0
  85. data/docs/syntax.md +46 -16
  86. data/docs/type_fingerprint.md +21 -0
  87. data/exe/rbs +1 -1
  88. data/ext/rbs_extension/ast_translation.c +595 -98
  89. data/ext/rbs_extension/class_constants.c +30 -0
  90. data/ext/rbs_extension/class_constants.h +15 -0
  91. data/ext/rbs_extension/legacy_location.c +30 -53
  92. data/ext/rbs_extension/legacy_location.h +37 -0
  93. data/ext/rbs_extension/main.c +125 -24
  94. data/include/rbs/ast.h +485 -150
  95. data/include/rbs/lexer.h +11 -4
  96. data/include/rbs/location.h +25 -44
  97. data/include/rbs/parser.h +20 -2
  98. data/include/rbs/util/rbs_constant_pool.h +0 -3
  99. data/include/rbs.h +8 -0
  100. data/lib/rbs/ast/annotation.rb +1 -1
  101. data/lib/rbs/ast/comment.rb +1 -1
  102. data/lib/rbs/ast/declarations.rb +10 -10
  103. data/lib/rbs/ast/members.rb +14 -14
  104. data/lib/rbs/ast/ruby/annotations.rb +409 -0
  105. data/lib/rbs/ast/ruby/comment_block.rb +245 -0
  106. data/lib/rbs/ast/ruby/declarations.rb +281 -0
  107. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  108. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  109. data/lib/rbs/ast/ruby/members.rb +723 -0
  110. data/lib/rbs/ast/type_param.rb +24 -4
  111. data/lib/rbs/buffer.rb +105 -20
  112. data/lib/rbs/cli/diff.rb +16 -15
  113. data/lib/rbs/cli/validate.rb +62 -125
  114. data/lib/rbs/cli.rb +55 -23
  115. data/lib/rbs/collection/config/lockfile_generator.rb +8 -4
  116. data/lib/rbs/collection/sources/git.rb +1 -0
  117. data/lib/rbs/collection.rb +0 -1
  118. data/lib/rbs/definition.rb +6 -1
  119. data/lib/rbs/definition_builder/ancestor_builder.rb +119 -63
  120. data/lib/rbs/definition_builder/method_builder.rb +65 -30
  121. data/lib/rbs/definition_builder.rb +177 -20
  122. data/lib/rbs/diff.rb +7 -1
  123. data/lib/rbs/environment/class_entry.rb +69 -0
  124. data/lib/rbs/environment/module_entry.rb +66 -0
  125. data/lib/rbs/environment.rb +338 -155
  126. data/lib/rbs/environment_loader.rb +2 -2
  127. data/lib/rbs/errors.rb +30 -20
  128. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  129. data/lib/rbs/inline_parser.rb +542 -0
  130. data/lib/rbs/location_aux.rb +36 -4
  131. data/lib/rbs/locator.rb +5 -1
  132. data/lib/rbs/method_type.rb +5 -3
  133. data/lib/rbs/namespace.rb +0 -7
  134. data/lib/rbs/parser_aux.rb +31 -8
  135. data/lib/rbs/prototype/helpers.rb +57 -0
  136. data/lib/rbs/prototype/rb.rb +3 -28
  137. data/lib/rbs/prototype/rbi.rb +3 -20
  138. data/lib/rbs/prototype/runtime.rb +10 -2
  139. data/lib/rbs/resolver/type_name_resolver.rb +0 -8
  140. data/lib/rbs/source.rb +99 -0
  141. data/lib/rbs/subtractor.rb +4 -3
  142. data/lib/rbs/test/type_check.rb +5 -2
  143. data/lib/rbs/type_name.rb +1 -8
  144. data/lib/rbs/types.rb +88 -78
  145. data/lib/rbs/unit_test/convertibles.rb +1 -0
  146. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  147. data/lib/rbs/validator.rb +2 -2
  148. data/lib/rbs/version.rb +1 -1
  149. data/lib/rbs.rb +12 -1
  150. data/rbs.gemspec +3 -2
  151. data/rust/.gitignore +1 -0
  152. data/rust/Cargo.lock +378 -0
  153. data/rust/Cargo.toml +7 -0
  154. data/rust/ruby-rbs/Cargo.toml +22 -0
  155. data/rust/ruby-rbs/build.rs +764 -0
  156. data/rust/ruby-rbs/examples/locations.rs +60 -0
  157. data/rust/ruby-rbs/src/lib.rs +1 -0
  158. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  159. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  160. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  161. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  162. data/rust/ruby-rbs-sys/build.rs +204 -0
  163. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  164. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  165. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  166. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  167. data/schema/typeParam.json +17 -1
  168. data/sig/ancestor_builder.rbs +1 -1
  169. data/sig/ast/ruby/annotations.rbs +421 -0
  170. data/sig/ast/ruby/comment_block.rbs +127 -0
  171. data/sig/ast/ruby/declarations.rbs +158 -0
  172. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  173. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  174. data/sig/ast/ruby/members.rbs +178 -0
  175. data/sig/buffer.rbs +63 -5
  176. data/sig/cli/diff.rbs +5 -11
  177. data/sig/cli/validate.rbs +12 -8
  178. data/sig/cli.rbs +18 -18
  179. data/sig/definition.rbs +6 -0
  180. data/sig/definition_builder.rbs +3 -1
  181. data/sig/environment/class_entry.rbs +50 -0
  182. data/sig/environment/module_entry.rbs +50 -0
  183. data/sig/environment.rbs +37 -81
  184. data/sig/errors.rbs +26 -20
  185. data/sig/inline_parser/comment_association.rbs +71 -0
  186. data/sig/inline_parser.rbs +124 -0
  187. data/sig/location.rbs +32 -7
  188. data/sig/locator.rbs +0 -2
  189. data/sig/method_builder.rbs +9 -4
  190. data/sig/namespace.rbs +0 -5
  191. data/sig/parser.rbs +47 -13
  192. data/sig/prototype/helpers.rbs +2 -0
  193. data/sig/resolver/type_name_resolver.rbs +0 -3
  194. data/sig/source.rbs +48 -0
  195. data/sig/type_param.rbs +13 -8
  196. data/sig/typename.rbs +0 -5
  197. data/sig/types.rbs +6 -7
  198. data/sig/unit_test/spy.rbs +0 -8
  199. data/sig/unit_test/type_assertions.rbs +11 -0
  200. data/src/ast.c +491 -143
  201. data/src/lexer.c +1552 -1314
  202. data/src/lexer.re +7 -0
  203. data/src/lexstate.c +8 -1
  204. data/src/location.c +8 -48
  205. data/src/parser.c +1107 -409
  206. data/src/util/rbs_constant_pool.c +0 -4
  207. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  208. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  209. data/stdlib/coverage/0/coverage.rbs +4 -3
  210. data/stdlib/date/0/date.rbs +33 -28
  211. data/stdlib/date/0/date_time.rbs +24 -23
  212. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  213. data/stdlib/digest/0/digest.rbs +110 -0
  214. data/stdlib/erb/0/erb.rbs +64 -53
  215. data/stdlib/etc/0/etc.rbs +55 -50
  216. data/stdlib/fileutils/0/fileutils.rbs +140 -126
  217. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  218. data/stdlib/io-console/0/io-console.rbs +2 -2
  219. data/stdlib/json/0/json.rbs +158 -131
  220. data/stdlib/monitor/0/monitor.rbs +3 -3
  221. data/stdlib/net-http/0/net-http.rbs +159 -134
  222. data/stdlib/objspace/0/objspace.rbs +8 -30
  223. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  224. data/stdlib/open3/0/open3.rbs +469 -10
  225. data/stdlib/openssl/0/openssl.rbs +144 -129
  226. data/stdlib/optparse/0/optparse.rbs +23 -14
  227. data/stdlib/pathname/0/pathname.rbs +2 -2
  228. data/stdlib/pp/0/pp.rbs +9 -8
  229. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  230. data/stdlib/pstore/0/pstore.rbs +35 -30
  231. data/stdlib/psych/0/psych.rbs +62 -9
  232. data/stdlib/psych/0/store.rbs +2 -4
  233. data/stdlib/pty/0/pty.rbs +9 -6
  234. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  235. data/stdlib/rdoc/0/code_object.rbs +2 -1
  236. data/stdlib/rdoc/0/parser.rbs +1 -1
  237. data/stdlib/rdoc/0/store.rbs +1 -1
  238. data/stdlib/ripper/0/ripper.rbs +20 -17
  239. data/stdlib/securerandom/0/manifest.yaml +2 -0
  240. data/stdlib/securerandom/0/securerandom.rbs +7 -20
  241. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  242. data/stdlib/socket/0/addrinfo.rbs +9 -9
  243. data/stdlib/socket/0/basic_socket.rbs +3 -3
  244. data/stdlib/socket/0/ip_socket.rbs +10 -8
  245. data/stdlib/socket/0/socket.rbs +10 -9
  246. data/stdlib/socket/0/tcp_server.rbs +1 -1
  247. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  248. data/stdlib/socket/0/udp_socket.rbs +1 -1
  249. data/stdlib/socket/0/unix_server.rbs +1 -1
  250. data/stdlib/stringio/0/stringio.rbs +55 -54
  251. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  252. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  253. data/stdlib/time/0/time.rbs +7 -5
  254. data/stdlib/tsort/0/tsort.rbs +7 -6
  255. data/stdlib/uri/0/common.rbs +31 -18
  256. data/stdlib/uri/0/file.rbs +2 -2
  257. data/stdlib/uri/0/generic.rbs +9 -2
  258. data/stdlib/uri/0/http.rbs +2 -2
  259. data/stdlib/uri/0/ldap.rbs +2 -2
  260. data/stdlib/uri/0/mailto.rbs +3 -3
  261. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  262. data/stdlib/zlib/0/deflate.rbs +4 -3
  263. data/stdlib/zlib/0/gzip_reader.rbs +6 -6
  264. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  265. data/stdlib/zlib/0/inflate.rbs +1 -1
  266. data/stdlib/zlib/0/need_dict.rbs +1 -1
  267. metadata +66 -3
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?
@@ -280,8 +281,6 @@ class Integer < Numeric
280
281
  | (Rational) -> Rational
281
282
  | (Complex) -> Complex
282
283
 
283
- def +@: () -> Integer
284
-
285
284
  # <!--
286
285
  # rdoc-file=numeric.c
287
286
  # - self - other -> numeric
@@ -393,7 +392,7 @@ class Integer < Numeric
393
392
  #
394
393
  # Returns:
395
394
  #
396
- # * `-1`, if `self` is less than `other`.
395
+ # * <code>-1</code>, if `self` is less than `other`.
397
396
  # * `0`, if `self` is equal to `other`.
398
397
  # * `1`, if `self` is greater then `other`.
399
398
  # * `nil`, if `self` and `other` are incomparable.
@@ -504,8 +503,8 @@ class Integer < Numeric
504
503
  # n[2] # => 0
505
504
  # n[3] # => 0
506
505
  #
507
- # In principle, `n[i]` is equivalent to `(n >> i) & 1`. Thus, negative index
508
- # 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:
509
508
  #
510
509
  # 255[-1] # => 0
511
510
  #
@@ -516,8 +515,9 @@ class Integer < Numeric
516
515
  # "%010b" % n[0, 10] # => "0000111000"
517
516
  # "%010b" % n[4, 10] # => "0000000011"
518
517
  #
519
- # With argument `range`, returns `range.size` bits from `self`, beginning at
520
- # `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:
521
521
  #
522
522
  # n = 0b111000 # => 56
523
523
  # "%010b" % n[0..9] # => "0000111000"
@@ -556,8 +556,6 @@ class Integer < Numeric
556
556
  #
557
557
  def abs: () -> Integer
558
558
 
559
- def abs2: () -> Integer
560
-
561
559
  # <!--
562
560
  # rdoc-file=numeric.c
563
561
  # - allbits?(mask) -> true or false
@@ -581,8 +579,6 @@ class Integer < Numeric
581
579
  #
582
580
  def allbits?: (int mask) -> bool
583
581
 
584
- def angle: () -> (Integer | Float)
585
-
586
582
  # <!--
587
583
  # rdoc-file=numeric.c
588
584
  # - anybits?(mask) -> true or false
@@ -617,7 +613,7 @@ class Integer < Numeric
617
613
  # significant bit has bit position 1). If there is no such bit (zero or minus
618
614
  # one), returns zero.
619
615
  #
620
- # This method returns `ceil(log2(self < 0 ? -self : self + 1))`>.
616
+ # This method returns <code>ceil(log2(self < 0 ? -self : self + 1))</code>>.
621
617
  #
622
618
  # (-2**1000-1).bit_length # => 1001
623
619
  # (-2**1000).bit_length # => 1000
@@ -670,7 +666,7 @@ class Integer < Numeric
670
666
  #
671
667
  # * When `self` is non-zero and `ndigits` is negative,
672
668
  # returns a value based on a computed granularity:
673
- # * The granularity is `10 ** ndigits.abs`.
669
+ # * The granularity is <code>10 ** ndigits.abs</code>.
674
670
  # * The returned value is the smallest multiple of the granularity
675
671
  # that is greater than or equal to `self`.
676
672
  # Examples with positive `self`:
@@ -747,10 +743,6 @@ class Integer < Numeric
747
743
  #
748
744
  def coerce: (Numeric) -> [ Numeric, Numeric ]
749
745
 
750
- def conj: () -> Integer
751
-
752
- def conjugate: () -> Integer
753
-
754
746
  # <!--
755
747
  # rdoc-file=numeric.rb
756
748
  # - denominator -> 1
@@ -796,7 +788,7 @@ class Integer < Numeric
796
788
  # rdoc-file=numeric.c
797
789
  # - divmod(other) -> array
798
790
  # -->
799
- # Returns a 2-element array `[q, r]`, where
791
+ # Returns a 2-element array <code>[q, r]</code>, where
800
792
  #
801
793
  # q = (self/other).floor # Quotient
802
794
  # r = self % other # Remainder
@@ -842,10 +834,6 @@ class Integer < Numeric
842
834
  def downto: (Numeric limit) { (Integer) -> void } -> Integer
843
835
  | (Numeric limit) -> ::Enumerator[Integer, self]
844
836
 
845
- def dup: () -> self
846
-
847
- def eql?: (untyped) -> bool
848
-
849
837
  # <!--
850
838
  # rdoc-file=numeric.rb
851
839
  # - even? -> true or false
@@ -870,8 +858,6 @@ class Integer < Numeric
870
858
  #
871
859
  def fdiv: (Numeric) -> Float
872
860
 
873
- def finite?: () -> bool
874
-
875
861
  # <!--
876
862
  # rdoc-file=numeric.c
877
863
  # - floor(ndigits = 0) -> integer
@@ -891,7 +877,7 @@ class Integer < Numeric
891
877
  #
892
878
  # * When `self` is non-zero and `ndigits` is negative,
893
879
  # returns a value based on a computed granularity:
894
- # * The granularity is `10 ** ndigits.abs`.
880
+ # * The granularity is <code>10 ** ndigits.abs</code>.
895
881
  # * The returned value is the largest multiple of the granularity
896
882
  # that is less than or equal to `self`.
897
883
  # Examples with positive `self`:
@@ -942,14 +928,6 @@ class Integer < Numeric
942
928
  #
943
929
  def gcdlcm: (Integer) -> [ Integer, Integer ]
944
930
 
945
- def i: () -> Complex
946
-
947
- def imag: () -> Integer
948
-
949
- def imaginary: () -> Integer
950
-
951
- def infinite?: () -> Integer?
952
-
953
931
  # <!-- rdoc-file=numeric.c -->
954
932
  # Returns a string containing the place-value representation of `self` in radix
955
933
  # `base` (in 2..36).
@@ -1024,7 +1002,7 @@ class Integer < Numeric
1024
1002
  def negative?: () -> bool
1025
1003
 
1026
1004
  # <!-- rdoc-file=numeric.c -->
1027
- # Returns the successor integer of `self` (equivalent to `self + 1`):
1005
+ # Returns the successor integer of `self` (equivalent to <code>self + 1</code>):
1028
1006
  #
1029
1007
  # 1.succ #=> 2
1030
1008
  # -1.succ #=> 0
@@ -1056,8 +1034,6 @@ class Integer < Numeric
1056
1034
  #
1057
1035
  def nobits?: (int mask) -> bool
1058
1036
 
1059
- def nonzero?: () -> self?
1060
-
1061
1037
  # <!--
1062
1038
  # rdoc-file=numeric.rb
1063
1039
  # - numerator -> self
@@ -1082,8 +1058,6 @@ class Integer < Numeric
1082
1058
  #
1083
1059
  def ord: () -> Integer
1084
1060
 
1085
- alias phase angle
1086
-
1087
1061
  def polar: () -> [ Integer, Integer | Float ]
1088
1062
 
1089
1063
  def positive?: () -> bool
@@ -1108,7 +1082,7 @@ class Integer < Numeric
1108
1082
  # rdoc-file=numeric.c
1109
1083
  # - pred -> next_integer
1110
1084
  # -->
1111
- # Returns the predecessor of `self` (equivalent to `self - 1`):
1085
+ # Returns the predecessor of `self` (equivalent to <code>self - 1</code>):
1112
1086
  #
1113
1087
  # 1.pred #=> 0
1114
1088
  # -1.pred #=> -2
@@ -1132,14 +1106,8 @@ class Integer < Numeric
1132
1106
  #
1133
1107
  def rationalize: (?Numeric eps) -> Rational
1134
1108
 
1135
- def real: () -> self
1136
-
1137
- def real?: () -> true
1138
-
1139
1109
  def rect: () -> [ Integer, Numeric ]
1140
1110
 
1141
- alias rectangular rect
1142
-
1143
1111
  # <!--
1144
1112
  # rdoc-file=numeric.c
1145
1113
  # - remainder(other) -> real_number
@@ -1173,8 +1141,8 @@ class Integer < Numeric
1173
1141
  # Returns `self` rounded to the nearest value with a precision of `ndigits`
1174
1142
  # decimal digits.
1175
1143
  #
1176
- # When `ndigits` is negative, the returned value has at least `ndigits.abs`
1177
- # trailing zeros:
1144
+ # When `ndigits` is negative, the returned value has at least
1145
+ # <code>ndigits.abs</code> trailing zeros:
1178
1146
  #
1179
1147
  # 555.round(-1) # => 560
1180
1148
  # 555.round(-2) # => 600
@@ -1191,17 +1159,18 @@ class Integer < Numeric
1191
1159
  # If keyword argument `half` is given, and `self` is equidistant from the two
1192
1160
  # candidate values, the rounding is according to the given `half` value:
1193
1161
  #
1194
- # * `:up` or `nil`: round away from zero:
1162
+ # * <code>:up</code> or `nil`: round away from zero:
1195
1163
  #
1196
1164
  # 25.round(-1, half: :up) # => 30
1197
1165
  # (-25).round(-1, half: :up) # => -30
1198
1166
  #
1199
- # * `:down`: round toward zero:
1167
+ # * <code>:down</code>: round toward zero:
1200
1168
  #
1201
1169
  # 25.round(-1, half: :down) # => 20
1202
1170
  # (-25).round(-1, half: :down) # => -20
1203
1171
  #
1204
- # * `: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:
1205
1174
  #
1206
1175
  # 25.round(-1, half: :even) # => 20
1207
1176
  # 15.round(-1, half: :even) # => 20
@@ -1230,22 +1199,11 @@ class Integer < Numeric
1230
1199
  #
1231
1200
  def size: () -> Integer
1232
1201
 
1233
- def step: () { (Integer) -> void } -> void
1234
- | (Numeric limit, ?Integer step) { (Integer) -> void } -> void
1235
- | (Numeric limit, ?Numeric step) { (Numeric) -> void } -> void
1236
- | (to: Numeric, ?by: Integer) { (Integer) -> void } -> void
1237
- | (by: Numeric, ?to: Numeric) { (Numeric) -> void } -> void
1238
- | () -> Enumerator[Integer, bot]
1239
- | (Numeric limit, ?Integer step) -> Enumerator[Integer]
1240
- | (Numeric limit, ?Numeric step) -> Enumerator[Numeric]
1241
- | (to: Numeric, ?by: Integer) -> Enumerator[Integer]
1242
- | (by: Numeric, ?to: Numeric) -> Enumerator[Numeric]
1243
-
1244
1202
  # <!--
1245
1203
  # rdoc-file=numeric.c
1246
1204
  # - succ -> next_integer
1247
1205
  # -->
1248
- # Returns the successor integer of `self` (equivalent to `self + 1`):
1206
+ # Returns the successor integer of `self` (equivalent to <code>self + 1</code>):
1249
1207
  #
1250
1208
  # 1.succ #=> 2
1251
1209
  # -1.succ #=> 0
@@ -1259,7 +1217,8 @@ class Integer < Numeric
1259
1217
  # - times {|i| ... } -> self
1260
1218
  # - times -> enumerator
1261
1219
  # -->
1262
- # 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>:
1263
1222
  #
1264
1223
  # a = []
1265
1224
  # 5.times {|i| a.push(i) } # => 5
@@ -1270,8 +1229,6 @@ class Integer < Numeric
1270
1229
  def times: () { (Integer) -> void } -> self
1271
1230
  | () -> ::Enumerator[Integer, self]
1272
1231
 
1273
- def to_c: () -> Complex
1274
-
1275
1232
  # <!--
1276
1233
  # rdoc-file=numeric.c
1277
1234
  # - to_f -> float
@@ -1377,8 +1334,8 @@ class Integer < Numeric
1377
1334
  # Returns `self` truncated (toward zero) to a precision of `ndigits` decimal
1378
1335
  # digits.
1379
1336
  #
1380
- # When `ndigits` is negative, the returned value has at least `ndigits.abs`
1381
- # trailing zeros:
1337
+ # When `ndigits` is negative, the returned value has at least
1338
+ # <code>ndigits.abs</code> trailing zeros:
1382
1339
  #
1383
1340
  # 555.truncate(-1) # => 550
1384
1341
  # 555.truncate(-2) # => 500