rbs 4.1.0.pre.2-java

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 (574) hide show
  1. checksums.yaml +7 -0
  2. data/.clang-format +75 -0
  3. data/.clangd +2 -0
  4. data/.github/dependabot.yml +24 -0
  5. data/.github/workflows/bundle-update.yml +63 -0
  6. data/.github/workflows/c-check.yml +61 -0
  7. data/.github/workflows/comments.yml +37 -0
  8. data/.github/workflows/dependabot.yml +30 -0
  9. data/.github/workflows/jruby.yml +67 -0
  10. data/.github/workflows/milestone.yml +83 -0
  11. data/.github/workflows/ruby.yml +158 -0
  12. data/.github/workflows/rust.yml +184 -0
  13. data/.github/workflows/truffleruby.yml +54 -0
  14. data/.github/workflows/typecheck.yml +39 -0
  15. data/.github/workflows/wasm.yml +53 -0
  16. data/.github/workflows/windows.yml +49 -0
  17. data/.gitignore +38 -0
  18. data/.rubocop.yml +72 -0
  19. data/BSDL +22 -0
  20. data/CHANGELOG.md +2292 -0
  21. data/COPYING +56 -0
  22. data/README.md +240 -0
  23. data/Rakefile +869 -0
  24. data/Steepfile +53 -0
  25. data/config.yml +913 -0
  26. data/core/array.rbs +4142 -0
  27. data/core/basic_object.rbs +376 -0
  28. data/core/binding.rbs +148 -0
  29. data/core/builtin.rbs +278 -0
  30. data/core/class.rbs +223 -0
  31. data/core/comparable.rbs +192 -0
  32. data/core/complex.rbs +812 -0
  33. data/core/constants.rbs +96 -0
  34. data/core/data.rbs +415 -0
  35. data/core/dir.rbs +993 -0
  36. data/core/encoding.rbs +1368 -0
  37. data/core/enumerable.rbs +2506 -0
  38. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  39. data/core/enumerator/product.rbs +92 -0
  40. data/core/enumerator.rbs +705 -0
  41. data/core/env.rbs +6 -0
  42. data/core/errno.rbs +682 -0
  43. data/core/errors.rbs +789 -0
  44. data/core/exception.rbs +485 -0
  45. data/core/false_class.rbs +82 -0
  46. data/core/fiber.rbs +570 -0
  47. data/core/fiber_error.rbs +11 -0
  48. data/core/file.rbs +2045 -0
  49. data/core/file_constants.rbs +463 -0
  50. data/core/file_stat.rbs +534 -0
  51. data/core/file_test.rbs +331 -0
  52. data/core/float.rbs +1316 -0
  53. data/core/gc.rbs +788 -0
  54. data/core/global_variables.rbs +184 -0
  55. data/core/hash.rbs +2183 -0
  56. data/core/integer.rbs +1374 -0
  57. data/core/io/buffer.rbs +995 -0
  58. data/core/io/wait.rbs +48 -0
  59. data/core/io.rbs +3472 -0
  60. data/core/kernel.rbs +3172 -0
  61. data/core/marshal.rbs +207 -0
  62. data/core/match_data.rbs +637 -0
  63. data/core/math.rbs +770 -0
  64. data/core/method.rbs +422 -0
  65. data/core/module.rbs +1856 -0
  66. data/core/nil_class.rbs +210 -0
  67. data/core/numeric.rbs +832 -0
  68. data/core/object.rbs +108 -0
  69. data/core/object_space/weak_key_map.rbs +166 -0
  70. data/core/object_space.rbs +197 -0
  71. data/core/pathname.rbs +1322 -0
  72. data/core/proc.rbs +905 -0
  73. data/core/process.rbs +2316 -0
  74. data/core/ractor.rbs +924 -0
  75. data/core/random.rbs +255 -0
  76. data/core/range.rbs +1209 -0
  77. data/core/rational.rbs +502 -0
  78. data/core/rb_config.rbs +88 -0
  79. data/core/rbs/ops.rbs +154 -0
  80. data/core/rbs/unnamed/argf.rbs +1236 -0
  81. data/core/rbs/unnamed/env_class.rbs +1214 -0
  82. data/core/rbs/unnamed/main_class.rbs +123 -0
  83. data/core/rbs/unnamed/random.rbs +186 -0
  84. data/core/refinement.rbs +59 -0
  85. data/core/regexp.rbs +1974 -0
  86. data/core/ruby.rbs +53 -0
  87. data/core/ruby_vm.rbs +809 -0
  88. data/core/rubygems/basic_specification.rbs +6 -0
  89. data/core/rubygems/config_file.rbs +38 -0
  90. data/core/rubygems/dependency_installer.rbs +6 -0
  91. data/core/rubygems/errors.rbs +109 -0
  92. data/core/rubygems/installer.rbs +15 -0
  93. data/core/rubygems/path_support.rbs +6 -0
  94. data/core/rubygems/platform.rbs +7 -0
  95. data/core/rubygems/request_set.rbs +49 -0
  96. data/core/rubygems/requirement.rbs +148 -0
  97. data/core/rubygems/rubygems.rbs +1105 -0
  98. data/core/rubygems/source_list.rbs +15 -0
  99. data/core/rubygems/specification.rbs +23 -0
  100. data/core/rubygems/stream_ui.rbs +5 -0
  101. data/core/rubygems/uninstaller.rbs +10 -0
  102. data/core/rubygems/version.rbs +293 -0
  103. data/core/set.rbs +751 -0
  104. data/core/signal.rbs +110 -0
  105. data/core/string.rbs +5532 -0
  106. data/core/struct.rbs +668 -0
  107. data/core/symbol.rbs +482 -0
  108. data/core/thread.rbs +1826 -0
  109. data/core/thread_group.rbs +79 -0
  110. data/core/time.rbs +1793 -0
  111. data/core/trace_point.rbs +483 -0
  112. data/core/true_class.rbs +98 -0
  113. data/core/unbound_method.rbs +337 -0
  114. data/core/warning.rbs +87 -0
  115. data/docs/CONTRIBUTING.md +107 -0
  116. data/docs/aliases.md +79 -0
  117. data/docs/architecture.md +110 -0
  118. data/docs/collection.md +192 -0
  119. data/docs/config.md +171 -0
  120. data/docs/data_and_struct.md +86 -0
  121. data/docs/encoding.md +56 -0
  122. data/docs/gem.md +56 -0
  123. data/docs/inline.md +634 -0
  124. data/docs/rbs_by_example.md +309 -0
  125. data/docs/repo.md +125 -0
  126. data/docs/rust.md +96 -0
  127. data/docs/sigs.md +167 -0
  128. data/docs/stdlib.md +147 -0
  129. data/docs/syntax.md +940 -0
  130. data/docs/tools.md +17 -0
  131. data/docs/type_fingerprint.md +21 -0
  132. data/docs/wasm_serialization.md +80 -0
  133. data/exe/rbs +7 -0
  134. data/ext/rbs_extension/ast_translation.c +1855 -0
  135. data/ext/rbs_extension/ast_translation.h +41 -0
  136. data/ext/rbs_extension/class_constants.c +187 -0
  137. data/ext/rbs_extension/class_constants.h +104 -0
  138. data/ext/rbs_extension/compat.h +10 -0
  139. data/ext/rbs_extension/extconf.rb +40 -0
  140. data/ext/rbs_extension/legacy_location.c +294 -0
  141. data/ext/rbs_extension/legacy_location.h +82 -0
  142. data/ext/rbs_extension/main.c +613 -0
  143. data/ext/rbs_extension/rbs_extension.h +16 -0
  144. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  145. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  146. data/goodcheck.yml +91 -0
  147. data/include/rbs/ast.h +1047 -0
  148. data/include/rbs/defines.h +99 -0
  149. data/include/rbs/lexer.h +207 -0
  150. data/include/rbs/location.h +40 -0
  151. data/include/rbs/parser.h +153 -0
  152. data/include/rbs/serialize.h +39 -0
  153. data/include/rbs/string.h +47 -0
  154. data/include/rbs/util/rbs_allocator.h +59 -0
  155. data/include/rbs/util/rbs_assert.h +20 -0
  156. data/include/rbs/util/rbs_buffer.h +83 -0
  157. data/include/rbs/util/rbs_constant_pool.h +155 -0
  158. data/include/rbs/util/rbs_encoding.h +282 -0
  159. data/include/rbs/util/rbs_unescape.h +24 -0
  160. data/include/rbs.h +14 -0
  161. data/lib/rbs/ancestor_graph.rb +92 -0
  162. data/lib/rbs/annotate/annotations.rb +199 -0
  163. data/lib/rbs/annotate/formatter.rb +82 -0
  164. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  165. data/lib/rbs/annotate/rdoc_source.rb +131 -0
  166. data/lib/rbs/annotate.rb +8 -0
  167. data/lib/rbs/ast/annotation.rb +29 -0
  168. data/lib/rbs/ast/comment.rb +29 -0
  169. data/lib/rbs/ast/declarations.rb +472 -0
  170. data/lib/rbs/ast/directives.rb +49 -0
  171. data/lib/rbs/ast/members.rb +451 -0
  172. data/lib/rbs/ast/ruby/annotations.rb +451 -0
  173. data/lib/rbs/ast/ruby/comment_block.rb +247 -0
  174. data/lib/rbs/ast/ruby/declarations.rb +291 -0
  175. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  176. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  177. data/lib/rbs/ast/ruby/members.rb +762 -0
  178. data/lib/rbs/ast/type_param.rb +235 -0
  179. data/lib/rbs/ast/visitor.rb +137 -0
  180. data/lib/rbs/buffer.rb +189 -0
  181. data/lib/rbs/builtin_names.rb +58 -0
  182. data/lib/rbs/cli/colored_io.rb +48 -0
  183. data/lib/rbs/cli/diff.rb +84 -0
  184. data/lib/rbs/cli/validate.rb +294 -0
  185. data/lib/rbs/cli.rb +1253 -0
  186. data/lib/rbs/collection/cleaner.rb +38 -0
  187. data/lib/rbs/collection/config/lockfile.rb +92 -0
  188. data/lib/rbs/collection/config/lockfile_generator.rb +269 -0
  189. data/lib/rbs/collection/config.rb +81 -0
  190. data/lib/rbs/collection/installer.rb +32 -0
  191. data/lib/rbs/collection/sources/base.rb +14 -0
  192. data/lib/rbs/collection/sources/git.rb +265 -0
  193. data/lib/rbs/collection/sources/local.rb +81 -0
  194. data/lib/rbs/collection/sources/rubygems.rb +48 -0
  195. data/lib/rbs/collection/sources/stdlib.rb +50 -0
  196. data/lib/rbs/collection/sources.rb +38 -0
  197. data/lib/rbs/collection.rb +16 -0
  198. data/lib/rbs/constant.rb +28 -0
  199. data/lib/rbs/definition.rb +415 -0
  200. data/lib/rbs/definition_builder/ancestor_builder.rb +678 -0
  201. data/lib/rbs/definition_builder/method_builder.rb +295 -0
  202. data/lib/rbs/definition_builder.rb +1054 -0
  203. data/lib/rbs/diff.rb +131 -0
  204. data/lib/rbs/environment/class_entry.rb +69 -0
  205. data/lib/rbs/environment/module_entry.rb +66 -0
  206. data/lib/rbs/environment/use_map.rb +77 -0
  207. data/lib/rbs/environment.rb +1028 -0
  208. data/lib/rbs/environment_loader.rb +167 -0
  209. data/lib/rbs/environment_walker.rb +155 -0
  210. data/lib/rbs/errors.rb +634 -0
  211. data/lib/rbs/factory.rb +18 -0
  212. data/lib/rbs/file_finder.rb +28 -0
  213. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  214. data/lib/rbs/inline_parser.rb +568 -0
  215. data/lib/rbs/location_aux.rb +170 -0
  216. data/lib/rbs/locator.rb +247 -0
  217. data/lib/rbs/method_type.rb +145 -0
  218. data/lib/rbs/namespace.rb +154 -0
  219. data/lib/rbs/parser/lex_result.rb +15 -0
  220. data/lib/rbs/parser/token.rb +23 -0
  221. data/lib/rbs/parser_aux.rb +142 -0
  222. data/lib/rbs/prototype/helpers.rb +197 -0
  223. data/lib/rbs/prototype/node_usage.rb +99 -0
  224. data/lib/rbs/prototype/rb.rb +816 -0
  225. data/lib/rbs/prototype/rbi.rb +625 -0
  226. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  227. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  228. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  229. data/lib/rbs/prototype/runtime.rb +680 -0
  230. data/lib/rbs/repository.rb +127 -0
  231. data/lib/rbs/resolver/constant_resolver.rb +219 -0
  232. data/lib/rbs/resolver/type_name_resolver.rb +167 -0
  233. data/lib/rbs/rewriter.rb +70 -0
  234. data/lib/rbs/sorter.rb +198 -0
  235. data/lib/rbs/source.rb +99 -0
  236. data/lib/rbs/substitution.rb +83 -0
  237. data/lib/rbs/subtractor.rb +204 -0
  238. data/lib/rbs/test/errors.rb +80 -0
  239. data/lib/rbs/test/guaranteed.rb +30 -0
  240. data/lib/rbs/test/hook.rb +212 -0
  241. data/lib/rbs/test/observer.rb +19 -0
  242. data/lib/rbs/test/setup.rb +84 -0
  243. data/lib/rbs/test/setup_helper.rb +50 -0
  244. data/lib/rbs/test/tester.rb +167 -0
  245. data/lib/rbs/test/type_check.rb +457 -0
  246. data/lib/rbs/test.rb +112 -0
  247. data/lib/rbs/type_alias_dependency.rb +100 -0
  248. data/lib/rbs/type_alias_regularity.rb +126 -0
  249. data/lib/rbs/type_name.rb +122 -0
  250. data/lib/rbs/types.rb +1604 -0
  251. data/lib/rbs/unit_test/convertibles.rb +177 -0
  252. data/lib/rbs/unit_test/spy.rb +138 -0
  253. data/lib/rbs/unit_test/type_assertions.rb +383 -0
  254. data/lib/rbs/unit_test/with_aliases.rb +145 -0
  255. data/lib/rbs/unit_test.rb +6 -0
  256. data/lib/rbs/validator.rb +186 -0
  257. data/lib/rbs/variance_calculator.rb +189 -0
  258. data/lib/rbs/vendorer.rb +71 -0
  259. data/lib/rbs/version.rb +5 -0
  260. data/lib/rbs/wasm/deserializer.rb +213 -0
  261. data/lib/rbs/wasm/jars/asm-analysis.jar +0 -0
  262. data/lib/rbs/wasm/jars/asm-commons.jar +0 -0
  263. data/lib/rbs/wasm/jars/asm-tree.jar +0 -0
  264. data/lib/rbs/wasm/jars/asm-util.jar +0 -0
  265. data/lib/rbs/wasm/jars/asm.jar +0 -0
  266. data/lib/rbs/wasm/jars/compiler.jar +0 -0
  267. data/lib/rbs/wasm/jars/log.jar +0 -0
  268. data/lib/rbs/wasm/jars/runtime.jar +0 -0
  269. data/lib/rbs/wasm/jars/wasi.jar +0 -0
  270. data/lib/rbs/wasm/jars/wasm.jar +0 -0
  271. data/lib/rbs/wasm/location.rb +61 -0
  272. data/lib/rbs/wasm/parser.rb +137 -0
  273. data/lib/rbs/wasm/rbs_parser.wasm +0 -0
  274. data/lib/rbs/wasm/runtime.rb +217 -0
  275. data/lib/rbs/wasm/serialization_schema.rb +110 -0
  276. data/lib/rbs/writer.rb +424 -0
  277. data/lib/rbs.rb +117 -0
  278. data/lib/rdoc/discover.rb +20 -0
  279. data/lib/rdoc_plugin/parser.rb +163 -0
  280. data/rbs.gemspec +68 -0
  281. data/schema/annotation.json +14 -0
  282. data/schema/comment.json +26 -0
  283. data/schema/decls.json +326 -0
  284. data/schema/function.json +87 -0
  285. data/schema/location.json +56 -0
  286. data/schema/members.json +266 -0
  287. data/schema/methodType.json +50 -0
  288. data/schema/typeParam.json +52 -0
  289. data/schema/types.json +317 -0
  290. data/sig/ancestor_builder.rbs +163 -0
  291. data/sig/ancestor_graph.rbs +60 -0
  292. data/sig/annotate/annotations.rbs +102 -0
  293. data/sig/annotate/formatter.rbs +24 -0
  294. data/sig/annotate/rdoc_annotater.rbs +85 -0
  295. data/sig/annotate/rdoc_source.rbs +32 -0
  296. data/sig/annotation.rbs +27 -0
  297. data/sig/ast/ruby/annotations.rbs +470 -0
  298. data/sig/ast/ruby/comment_block.rbs +127 -0
  299. data/sig/ast/ruby/declarations.rbs +158 -0
  300. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  301. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  302. data/sig/ast/ruby/members.rbs +198 -0
  303. data/sig/buffer.rbs +108 -0
  304. data/sig/builtin_names.rbs +44 -0
  305. data/sig/cli/colored_io.rbs +15 -0
  306. data/sig/cli/diff.rbs +15 -0
  307. data/sig/cli/validate.rbs +47 -0
  308. data/sig/cli.rbs +89 -0
  309. data/sig/collection/cleaner.rbs +13 -0
  310. data/sig/collection/config/lockfile.rbs +74 -0
  311. data/sig/collection/config/lockfile_generator.rbs +68 -0
  312. data/sig/collection/config.rbs +46 -0
  313. data/sig/collection/installer.rbs +17 -0
  314. data/sig/collection/sources.rbs +214 -0
  315. data/sig/collection.rbs +4 -0
  316. data/sig/comment.rbs +26 -0
  317. data/sig/constant.rbs +21 -0
  318. data/sig/declarations.rbs +274 -0
  319. data/sig/definition.rbs +232 -0
  320. data/sig/definition_builder.rbs +181 -0
  321. data/sig/diff.rbs +28 -0
  322. data/sig/directives.rbs +77 -0
  323. data/sig/environment/class_entry.rbs +50 -0
  324. data/sig/environment/module_entry.rbs +50 -0
  325. data/sig/environment.rbs +286 -0
  326. data/sig/environment_loader.rbs +111 -0
  327. data/sig/environment_walker.rbs +65 -0
  328. data/sig/errors.rbs +408 -0
  329. data/sig/factory.rbs +5 -0
  330. data/sig/file_finder.rbs +28 -0
  331. data/sig/inline_parser/comment_association.rbs +71 -0
  332. data/sig/inline_parser.rbs +126 -0
  333. data/sig/location.rbs +135 -0
  334. data/sig/locator.rbs +56 -0
  335. data/sig/manifest.yaml +5 -0
  336. data/sig/members.rbs +258 -0
  337. data/sig/method_builder.rbs +89 -0
  338. data/sig/method_types.rbs +58 -0
  339. data/sig/namespace.rbs +161 -0
  340. data/sig/parser.rbs +164 -0
  341. data/sig/prototype/helpers.rbs +29 -0
  342. data/sig/prototype/node_usage.rbs +20 -0
  343. data/sig/prototype/rb.rbs +96 -0
  344. data/sig/prototype/rbi.rbs +75 -0
  345. data/sig/prototype/runtime.rbs +182 -0
  346. data/sig/rbs.rbs +21 -0
  347. data/sig/rdoc/rbs.rbs +67 -0
  348. data/sig/repository.rbs +85 -0
  349. data/sig/resolver/constant_resolver.rbs +92 -0
  350. data/sig/resolver/context.rbs +34 -0
  351. data/sig/resolver/type_name_resolver.rbs +61 -0
  352. data/sig/rewriter.rbs +45 -0
  353. data/sig/shims/bundler.rbs +38 -0
  354. data/sig/shims/enumerable.rbs +5 -0
  355. data/sig/shims/rubygems.rbs +19 -0
  356. data/sig/sorter.rbs +41 -0
  357. data/sig/source.rbs +48 -0
  358. data/sig/substitution.rbs +48 -0
  359. data/sig/subtractor.rbs +37 -0
  360. data/sig/test/errors.rbs +52 -0
  361. data/sig/test/guranteed.rbs +9 -0
  362. data/sig/test/type_check.rbs +19 -0
  363. data/sig/test.rbs +82 -0
  364. data/sig/type_alias_dependency.rbs +53 -0
  365. data/sig/type_alias_regularity.rbs +98 -0
  366. data/sig/type_param.rbs +115 -0
  367. data/sig/typename.rbs +89 -0
  368. data/sig/types.rbs +578 -0
  369. data/sig/unit_test/convertibles.rbs +154 -0
  370. data/sig/unit_test/spy.rbs +22 -0
  371. data/sig/unit_test/type_assertions.rbs +211 -0
  372. data/sig/unit_test/with_aliases.rbs +136 -0
  373. data/sig/use_map.rbs +35 -0
  374. data/sig/util.rbs +9 -0
  375. data/sig/validator.rbs +63 -0
  376. data/sig/variance_calculator.rbs +87 -0
  377. data/sig/vendorer.rbs +51 -0
  378. data/sig/version.rbs +3 -0
  379. data/sig/visitor.rbs +47 -0
  380. data/sig/wasm/deserializer.rbs +66 -0
  381. data/sig/wasm/serialization_schema.rbs +13 -0
  382. data/sig/writer.rbs +127 -0
  383. data/src/ast.c +1628 -0
  384. data/src/lexer.c +3217 -0
  385. data/src/lexer.re +155 -0
  386. data/src/lexstate.c +217 -0
  387. data/src/location.c +31 -0
  388. data/src/parser.c +4255 -0
  389. data/src/serialize.c +958 -0
  390. data/src/string.c +41 -0
  391. data/src/util/rbs_allocator.c +162 -0
  392. data/src/util/rbs_assert.c +19 -0
  393. data/src/util/rbs_buffer.c +54 -0
  394. data/src/util/rbs_constant_pool.c +268 -0
  395. data/src/util/rbs_encoding.c +21308 -0
  396. data/src/util/rbs_unescape.c +167 -0
  397. data/stdlib/abbrev/0/abbrev.rbs +66 -0
  398. data/stdlib/abbrev/0/array.rbs +26 -0
  399. data/stdlib/base64/0/base64.rbs +355 -0
  400. data/stdlib/benchmark/0/benchmark.rbs +452 -0
  401. data/stdlib/bigdecimal/0/big_decimal.rbs +1647 -0
  402. data/stdlib/bigdecimal-math/0/big_math.rbs +280 -0
  403. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  404. data/stdlib/cgi/0/core.rbs +911 -0
  405. data/stdlib/cgi/0/manifest.yaml +4 -0
  406. data/stdlib/cgi-escape/0/escape.rbs +171 -0
  407. data/stdlib/coverage/0/coverage.rbs +266 -0
  408. data/stdlib/csv/0/csv.rbs +3776 -0
  409. data/stdlib/csv/0/manifest.yaml +3 -0
  410. data/stdlib/date/0/date.rbs +1598 -0
  411. data/stdlib/date/0/date_time.rbs +617 -0
  412. data/stdlib/date/0/time.rbs +26 -0
  413. data/stdlib/dbm/0/dbm.rbs +421 -0
  414. data/stdlib/delegate/0/delegator.rbs +187 -0
  415. data/stdlib/delegate/0/kernel.rbs +47 -0
  416. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  417. data/stdlib/did_you_mean/0/did_you_mean.rbs +344 -0
  418. data/stdlib/digest/0/digest.rbs +687 -0
  419. data/stdlib/erb/0/erb.rbs +933 -0
  420. data/stdlib/etc/0/etc.rbs +884 -0
  421. data/stdlib/fileutils/0/fileutils.rbs +1753 -0
  422. data/stdlib/find/0/find.rbs +49 -0
  423. data/stdlib/forwardable/0/forwardable.rbs +271 -0
  424. data/stdlib/io-console/0/io-console.rbs +414 -0
  425. data/stdlib/ipaddr/0/ipaddr.rbs +436 -0
  426. data/stdlib/json/0/json.rbs +1963 -0
  427. data/stdlib/kconv/0/kconv.rbs +166 -0
  428. data/stdlib/logger/0/formatter.rbs +45 -0
  429. data/stdlib/logger/0/log_device.rbs +100 -0
  430. data/stdlib/logger/0/logger.rbs +796 -0
  431. data/stdlib/logger/0/manifest.yaml +2 -0
  432. data/stdlib/logger/0/period.rbs +17 -0
  433. data/stdlib/logger/0/severity.rbs +34 -0
  434. data/stdlib/minitest/0/kernel.rbs +42 -0
  435. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
  436. data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
  437. data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
  438. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
  439. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  440. data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
  441. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  442. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  443. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  444. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  445. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  446. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  447. data/stdlib/minitest/0/minitest/mock.rbs +64 -0
  448. data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
  449. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
  450. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  451. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  452. data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
  453. data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
  454. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  455. data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
  456. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  457. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  458. data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
  459. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  460. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  461. data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
  462. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  463. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
  464. data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
  465. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  466. data/stdlib/minitest/0/minitest/test.rbs +69 -0
  467. data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
  468. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  469. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  470. data/stdlib/minitest/0/minitest/unit.rbs +4 -0
  471. data/stdlib/minitest/0/minitest.rbs +115 -0
  472. data/stdlib/monitor/0/monitor.rbs +363 -0
  473. data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
  474. data/stdlib/net-http/0/manifest.yaml +3 -0
  475. data/stdlib/net-http/0/net-http.rbs +5580 -0
  476. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  477. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  478. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  479. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  480. data/stdlib/nkf/0/nkf.rbs +402 -0
  481. data/stdlib/objspace/0/objspace.rbs +470 -0
  482. data/stdlib/observable/0/observable.rbs +217 -0
  483. data/stdlib/open-uri/0/manifest.yaml +4 -0
  484. data/stdlib/open-uri/0/open-uri.rbs +433 -0
  485. data/stdlib/open3/0/open3.rbs +606 -0
  486. data/stdlib/openssl/0/manifest.yaml +3 -0
  487. data/stdlib/openssl/0/openssl.rbs +12231 -0
  488. data/stdlib/optparse/0/optparse.rbs +1734 -0
  489. data/stdlib/pathname/0/pathname.rbs +36 -0
  490. data/stdlib/pp/0/manifest.yaml +2 -0
  491. data/stdlib/pp/0/pp.rbs +301 -0
  492. data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
  493. data/stdlib/pstore/0/pstore.rbs +608 -0
  494. data/stdlib/psych/0/core_ext.rbs +12 -0
  495. data/stdlib/psych/0/dbm.rbs +237 -0
  496. data/stdlib/psych/0/manifest.yaml +3 -0
  497. data/stdlib/psych/0/psych.rbs +455 -0
  498. data/stdlib/psych/0/store.rbs +57 -0
  499. data/stdlib/pty/0/pty.rbs +240 -0
  500. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  501. data/stdlib/rdoc/0/code_object.rbs +52 -0
  502. data/stdlib/rdoc/0/comment.rbs +61 -0
  503. data/stdlib/rdoc/0/context.rbs +153 -0
  504. data/stdlib/rdoc/0/markup.rbs +117 -0
  505. data/stdlib/rdoc/0/options.rbs +76 -0
  506. data/stdlib/rdoc/0/parser.rbs +56 -0
  507. data/stdlib/rdoc/0/rdoc.rbs +393 -0
  508. data/stdlib/rdoc/0/ri.rbs +17 -0
  509. data/stdlib/rdoc/0/store.rbs +48 -0
  510. data/stdlib/rdoc/0/top_level.rbs +97 -0
  511. data/stdlib/resolv/0/manifest.yaml +3 -0
  512. data/stdlib/resolv/0/resolv.rbs +1787 -0
  513. data/stdlib/ripper/0/ripper.rbs +1654 -0
  514. data/stdlib/securerandom/0/manifest.yaml +2 -0
  515. data/stdlib/securerandom/0/securerandom.rbs +49 -0
  516. data/stdlib/shellwords/0/shellwords.rbs +229 -0
  517. data/stdlib/singleton/0/singleton.rbs +134 -0
  518. data/stdlib/socket/0/addrinfo.rbs +666 -0
  519. data/stdlib/socket/0/basic_socket.rbs +590 -0
  520. data/stdlib/socket/0/constants.rbs +2295 -0
  521. data/stdlib/socket/0/ip_socket.rbs +94 -0
  522. data/stdlib/socket/0/socket.rbs +4170 -0
  523. data/stdlib/socket/0/socket_error.rbs +5 -0
  524. data/stdlib/socket/0/tcp_server.rbs +192 -0
  525. data/stdlib/socket/0/tcp_socket.rbs +87 -0
  526. data/stdlib/socket/0/udp_socket.rbs +133 -0
  527. data/stdlib/socket/0/unix_server.rbs +169 -0
  528. data/stdlib/socket/0/unix_socket.rbs +172 -0
  529. data/stdlib/stringio/0/stringio.rbs +1681 -0
  530. data/stdlib/strscan/0/string_scanner.rbs +1648 -0
  531. data/stdlib/tempfile/0/tempfile.rbs +483 -0
  532. data/stdlib/time/0/time.rbs +434 -0
  533. data/stdlib/timeout/0/timeout.rbs +137 -0
  534. data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
  535. data/stdlib/tsort/0/cyclic.rbs +8 -0
  536. data/stdlib/tsort/0/interfaces.rbs +20 -0
  537. data/stdlib/tsort/0/tsort.rbs +410 -0
  538. data/stdlib/uri/0/common.rbs +621 -0
  539. data/stdlib/uri/0/file.rbs +118 -0
  540. data/stdlib/uri/0/ftp.rbs +13 -0
  541. data/stdlib/uri/0/generic.rbs +1116 -0
  542. data/stdlib/uri/0/http.rbs +104 -0
  543. data/stdlib/uri/0/https.rbs +14 -0
  544. data/stdlib/uri/0/ldap.rbs +230 -0
  545. data/stdlib/uri/0/ldaps.rbs +14 -0
  546. data/stdlib/uri/0/mailto.rbs +92 -0
  547. data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
  548. data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
  549. data/stdlib/uri/0/ws.rbs +13 -0
  550. data/stdlib/uri/0/wss.rbs +9 -0
  551. data/stdlib/yaml/0/manifest.yaml +2 -0
  552. data/stdlib/yaml/0/yaml.rbs +1 -0
  553. data/stdlib/zlib/0/buf_error.rbs +10 -0
  554. data/stdlib/zlib/0/data_error.rbs +10 -0
  555. data/stdlib/zlib/0/deflate.rbs +211 -0
  556. data/stdlib/zlib/0/error.rbs +20 -0
  557. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  558. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  559. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  560. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  561. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  562. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  563. data/stdlib/zlib/0/gzip_writer.rbs +168 -0
  564. data/stdlib/zlib/0/inflate.rbs +180 -0
  565. data/stdlib/zlib/0/mem_error.rbs +10 -0
  566. data/stdlib/zlib/0/need_dict.rbs +13 -0
  567. data/stdlib/zlib/0/stream_end.rbs +11 -0
  568. data/stdlib/zlib/0/stream_error.rbs +11 -0
  569. data/stdlib/zlib/0/version_error.rbs +11 -0
  570. data/stdlib/zlib/0/zlib.rbs +449 -0
  571. data/stdlib/zlib/0/zstream.rbs +201 -0
  572. data/wasm/README.md +59 -0
  573. data/wasm/rbs_wasm.c +411 -0
  574. metadata +660 -0
data/core/module.rbs ADDED
@@ -0,0 +1,1856 @@
1
+ # <!-- rdoc-file=object.c -->
2
+ # A Module is a collection of methods and constants. The methods in a module may
3
+ # be instance methods or module methods. Instance methods appear as methods in a
4
+ # class when the module is included, module methods do not. Conversely, module
5
+ # methods may be called without creating an encapsulating object, while instance
6
+ # methods may not. (See Module#module_function.)
7
+ #
8
+ # In the descriptions that follow, the parameter *sym* refers to a symbol, which
9
+ # is either a quoted string or a Symbol (such as <code>:name</code>).
10
+ #
11
+ # module Mod
12
+ # include Math
13
+ # CONST = 1
14
+ # def meth
15
+ # # ...
16
+ # end
17
+ # end
18
+ # Mod.class #=> Module
19
+ # Mod.constants #=> [:CONST, :PI, :E]
20
+ # Mod.instance_methods #=> [:meth]
21
+ #
22
+ class Module
23
+ # <!--
24
+ # rdoc-file=eval.c
25
+ # - Module.constants -> array
26
+ # - Module.constants(inherited) -> array
27
+ # -->
28
+ # In the first form, returns an array of the names of all constants accessible
29
+ # from the point of call. This list includes the names of all modules and
30
+ # classes defined in the global scope.
31
+ #
32
+ # Module.constants.first(4)
33
+ # # => [:ARGF, :ARGV, :ArgumentError, :Array]
34
+ #
35
+ # Module.constants.include?(:SEEK_SET) # => false
36
+ #
37
+ # class IO
38
+ # Module.constants.include?(:SEEK_SET) # => true
39
+ # end
40
+ #
41
+ # The second form calls the instance method `constants`.
42
+ #
43
+ def self.constants: (?boolish inherit) -> Array[Symbol]
44
+
45
+ # <!--
46
+ # rdoc-file=eval.c
47
+ # - Module.nesting -> array
48
+ # -->
49
+ # Returns the list of `Modules` nested at the point of call.
50
+ #
51
+ # module M1
52
+ # module M2
53
+ # $a = Module.nesting
54
+ # end
55
+ # end
56
+ # $a #=> [M1::M2, M1]
57
+ # $a[0].name #=> "M1::M2"
58
+ #
59
+ def self.nesting: () -> Array[Module]
60
+
61
+ # <!--
62
+ # rdoc-file=eval.c
63
+ # - used_modules -> array
64
+ # -->
65
+ # Returns an array of all modules used in the current scope. The ordering of
66
+ # modules in the resulting array is not defined.
67
+ #
68
+ # module A
69
+ # refine Object do
70
+ # end
71
+ # end
72
+ #
73
+ # module B
74
+ # refine Object do
75
+ # end
76
+ # end
77
+ #
78
+ # using A
79
+ # using B
80
+ # p Module.used_modules
81
+ #
82
+ # <em>produces:</em>
83
+ #
84
+ # [B, A]
85
+ #
86
+ def self.used_modules: () -> Array[Module]
87
+
88
+ # <!--
89
+ # rdoc-file=eval.c
90
+ # - used_refinements -> array
91
+ # -->
92
+ # Returns an array of all modules used in the current scope. The ordering of
93
+ # modules in the resulting array is not defined.
94
+ #
95
+ # module A
96
+ # refine Object do
97
+ # end
98
+ # end
99
+ #
100
+ # module B
101
+ # refine Object do
102
+ # end
103
+ # end
104
+ #
105
+ # using A
106
+ # using B
107
+ # p Module.used_refinements
108
+ #
109
+ # <em>produces:</em>
110
+ #
111
+ # [#<refinement:Object@B>, #<refinement:Object@A>]
112
+ #
113
+ def self.used_refinements: () -> Array[Refinement]
114
+
115
+ # <!--
116
+ # rdoc-file=object.c
117
+ # - self < other -> true, false, or nil
118
+ # -->
119
+ # Returns whether `self` is a subclass of `other`, or `nil` if there is no
120
+ # relationship between the two:
121
+ #
122
+ # Float < Numeric # => true
123
+ # Numeric < Float # => false
124
+ # Float < Float # => false
125
+ # Float < Hash # => nil
126
+ #
127
+ def <: (Module other) -> bool?
128
+
129
+ # <!--
130
+ # rdoc-file=object.c
131
+ # - mod <= other -> true, false, or nil
132
+ # -->
133
+ # Returns true if *mod* is a subclass of *other* or is the same as *other*.
134
+ # Returns `nil` if there's no relationship between the two. (Think of the
135
+ # relationship in terms of the class definition: "class A < B" implies "A < B".)
136
+ #
137
+ def <=: (Module other) -> bool?
138
+
139
+ # <!--
140
+ # rdoc-file=object.c
141
+ # - self <=> other -> -1, 0, 1, or nil
142
+ # -->
143
+ # Compares `self` and `other`.
144
+ #
145
+ # Returns:
146
+ #
147
+ # * <code>-1</code>, if `self` includes `other`, if or `self` is a subclass of
148
+ # `other`.
149
+ # * `0`, if `self` and `other` are the same.
150
+ # * `1`, if `other` includes `self`, or if `other` is a subclass of `self`.
151
+ # * `nil`, if none of the above is true.
152
+ #
153
+ # Examples:
154
+ #
155
+ # # Class Array includes module Enumerable.
156
+ # Array <=> Enumerable # => -1
157
+ # Enumerable <=> Enumerable # => 0
158
+ # Enumerable <=> Array # => 1
159
+ # # Class File is a subclass of class IO.
160
+ # File <=> IO # => -1
161
+ # File <=> File # => 0
162
+ # IO <=> File # => 1
163
+ # # Class File has no relationship to class String.
164
+ # File <=> String # => nil
165
+ #
166
+ def <=>: (untyped other) -> (-1 | 0 | 1)?
167
+
168
+ # <!--
169
+ # rdoc-file=object.c
170
+ # - obj == other -> true or false
171
+ # - obj.equal?(other) -> true or false
172
+ # - obj.eql?(other) -> true or false
173
+ # -->
174
+ # Equality --- At the Object level, #== returns `true` only if `obj` and `other`
175
+ # are the same object. Typically, this method is overridden in descendant
176
+ # classes to provide class-specific meaning.
177
+ #
178
+ # Unlike #==, the #equal? method should never be overridden by subclasses as it
179
+ # is used to determine object identity (that is, <code>a.equal?(b)</code> if and
180
+ # only if `a` is the same object as `b`):
181
+ #
182
+ # obj = "a"
183
+ # other = obj.dup
184
+ #
185
+ # obj == other #=> true
186
+ # obj.equal? other #=> false
187
+ # obj.equal? obj #=> true
188
+ #
189
+ # The #eql? method returns `true` if `obj` and `other` refer to the same hash
190
+ # key. This is used by Hash to test members for equality. For any pair of
191
+ # objects where #eql? returns `true`, the #hash value of both objects must be
192
+ # equal. So any subclass that overrides #eql? should also override #hash
193
+ # appropriately.
194
+ #
195
+ # For objects of class Object, #eql? is synonymous with #==. Subclasses
196
+ # normally continue this tradition by aliasing #eql? to their overridden #==
197
+ # method, but there are exceptions. Numeric types, for example, perform type
198
+ # conversion across #==, but not across #eql?, so:
199
+ #
200
+ # 1 == 1.0 #=> true
201
+ # 1.eql? 1.0 #=> false
202
+ #
203
+ def ==: (untyped other) -> bool
204
+
205
+ # <!--
206
+ # rdoc-file=object.c
207
+ # - mod === obj -> true or false
208
+ # -->
209
+ # Case Equality---Returns `true` if *obj* is an instance of *mod* or an instance
210
+ # of one of *mod*'s descendants. Of limited use for modules, but can be used in
211
+ # `case` statements to classify objects by class.
212
+ #
213
+ def ===: (untyped other) -> bool
214
+
215
+ # <!--
216
+ # rdoc-file=object.c
217
+ # - mod > other -> true, false, or nil
218
+ # -->
219
+ # Returns true if *mod* is an ancestor of *other*. Returns `false` if *mod* is
220
+ # the same as *other* or *mod* is a descendant of *other*. Returns `nil` if
221
+ # there's no relationship between the two. (Think of the relationship in terms
222
+ # of the class definition: "class A < B" implies "B > A".)
223
+ #
224
+ def >: (Module other) -> bool?
225
+
226
+ # <!--
227
+ # rdoc-file=object.c
228
+ # - mod >= other -> true, false, or nil
229
+ # -->
230
+ # Returns true if *mod* is an ancestor of *other*, or the two modules are the
231
+ # same. Returns `nil` if there's no relationship between the two. (Think of the
232
+ # relationship in terms of the class definition: "class A < B" implies "B > A".)
233
+ #
234
+ def >=: (Module other) -> bool?
235
+
236
+ # <!--
237
+ # rdoc-file=vm_method.c
238
+ # - alias_method(new_name, old_name) -> symbol
239
+ # -->
240
+ # Makes *new_name* a new copy of the method *old_name*. This can be used to
241
+ # retain access to methods that are overridden.
242
+ #
243
+ # module Mod
244
+ # alias_method :orig_exit, :exit #=> :orig_exit
245
+ # def exit(code=0)
246
+ # puts "Exiting with code #{code}"
247
+ # orig_exit(code)
248
+ # end
249
+ # end
250
+ # include Mod
251
+ # exit(99)
252
+ #
253
+ # <em>produces:</em>
254
+ #
255
+ # Exiting with code 99
256
+ #
257
+ def alias_method: (interned new_name, interned old_name) -> Symbol
258
+
259
+ # <!--
260
+ # rdoc-file=object.c
261
+ # - mod.ancestors -> array
262
+ # -->
263
+ # Returns a list of modules included/prepended in *mod* (including *mod*
264
+ # itself).
265
+ #
266
+ # module Mod
267
+ # include Math
268
+ # include Comparable
269
+ # prepend Enumerable
270
+ # end
271
+ #
272
+ # Mod.ancestors #=> [Enumerable, Mod, Comparable, Math]
273
+ # Math.ancestors #=> [Math]
274
+ # Enumerable.ancestors #=> [Enumerable]
275
+ #
276
+ def ancestors: () -> Array[Module]
277
+
278
+ # <!--
279
+ # rdoc-file=eval.c
280
+ # - append_features(mod) -> mod
281
+ # -->
282
+ # When this module is included in another, Ruby calls #append_features in this
283
+ # module, passing it the receiving module in *mod*. Ruby's default
284
+ # implementation is to add the constants, methods, and module variables of this
285
+ # module to *mod* if this module has not already been added to *mod* or one of
286
+ # its ancestors. See also Module#include.
287
+ #
288
+ private def append_features: (Module mod) -> self
289
+
290
+ # <!--
291
+ # rdoc-file=object.c
292
+ # - attr_accessor(symbol, ...) -> array
293
+ # - attr_accessor(string, ...) -> array
294
+ # -->
295
+ # Defines a named attribute for this module, where the name is
296
+ # <em>symbol.</em>`id2name`, creating an instance variable (<code>@name</code>)
297
+ # and a corresponding access method to read it. Also creates a method called
298
+ # <code>name=</code> to set the attribute. String arguments are converted to
299
+ # symbols. Returns an array of defined method names as symbols.
300
+ #
301
+ # module Mod
302
+ # attr_accessor(:one, :two) #=> [:one, :one=, :two, :two=]
303
+ # end
304
+ # Mod.instance_methods.sort #=> [:one, :one=, :two, :two=]
305
+ #
306
+ def attr_accessor: (*interned names) -> Array[Symbol]
307
+
308
+ # <!--
309
+ # rdoc-file=object.c
310
+ # - attr_reader(symbol, ...) -> array
311
+ # - attr(symbol, ...) -> array
312
+ # - attr_reader(string, ...) -> array
313
+ # - attr(string, ...) -> array
314
+ # -->
315
+ # Creates instance variables and corresponding methods that return the value of
316
+ # each instance variable. Equivalent to calling ```attr`<em>:name</em>'' on each
317
+ # name in turn. String arguments are converted to symbols. Returns an array of
318
+ # defined method names as symbols.
319
+ #
320
+ def attr_reader: (*interned names) -> Array[Symbol]
321
+
322
+ # <!--
323
+ # rdoc-file=object.c
324
+ # - attr_writer(symbol, ...) -> array
325
+ # - attr_writer(string, ...) -> array
326
+ # -->
327
+ # Creates an accessor method to allow assignment to the attribute
328
+ # *symbol*<code>.id2name</code>. String arguments are converted to symbols.
329
+ # Returns an array of defined method names as symbols.
330
+ #
331
+ def attr_writer: (*interned names) -> Array[Symbol]
332
+
333
+ # <!--
334
+ # rdoc-file=load.c
335
+ # - mod.autoload(const, filename) -> nil
336
+ # -->
337
+ # Registers *filename* to be loaded (using Kernel::require) the first time that
338
+ # *const* (which may be a String or a symbol) is accessed in the namespace of
339
+ # *mod*.
340
+ #
341
+ # module A
342
+ # end
343
+ # A.autoload(:B, "b")
344
+ # A::B.doit # autoloads "b"
345
+ #
346
+ # If *const* in *mod* is defined as autoload, the file name to be loaded is
347
+ # replaced with *filename*. If *const* is defined but not as autoload, does
348
+ # nothing.
349
+ #
350
+ # Files that are currently being loaded must not be registered for autoload.
351
+ #
352
+ def autoload: (interned constant, path filename) -> nil
353
+
354
+ # <!--
355
+ # rdoc-file=load.c
356
+ # - mod.autoload?(name, inherit=true) -> String or nil
357
+ # -->
358
+ # Returns *filename* to be loaded if *name* is registered as `autoload` in the
359
+ # namespace of *mod* or one of its ancestors.
360
+ #
361
+ # module A
362
+ # end
363
+ # A.autoload(:B, "b")
364
+ # A.autoload?(:B) #=> "b"
365
+ #
366
+ # If `inherit` is false, the lookup only checks the autoloads in the receiver:
367
+ #
368
+ # class A
369
+ # autoload :CONST, "const.rb"
370
+ # end
371
+ #
372
+ # class B < A
373
+ # end
374
+ #
375
+ # B.autoload?(:CONST) #=> "const.rb", found in A (ancestor)
376
+ # B.autoload?(:CONST, false) #=> nil, not found in B itself
377
+ #
378
+ def autoload?: (interned name, ?boolish inherit) -> String?
379
+
380
+ # <!-- rdoc-file=vm_eval.c -->
381
+ # Evaluates the string or block in the context of *mod*, except that when a
382
+ # block is given, constant/class variable lookup is not affected. This can be
383
+ # used to add methods to a class. `module_eval` returns the result of evaluating
384
+ # its argument. The optional *filename* and *lineno* parameters set the text for
385
+ # error messages.
386
+ #
387
+ # class Thing
388
+ # end
389
+ # a = %q{def hello() "Hello there!" end}
390
+ # Thing.module_eval(a)
391
+ # puts Thing.new.hello()
392
+ # Thing.module_eval("invalid code", "dummy", 123)
393
+ #
394
+ # <em>produces:</em>
395
+ #
396
+ # Hello there!
397
+ # dummy:123:in `module_eval': undefined local variable
398
+ # or method `code' for Thing:Class
399
+ #
400
+ alias class_eval module_eval
401
+
402
+ # <!-- rdoc-file=vm_eval.c -->
403
+ # Evaluates the given block in the context of the class/module. The method
404
+ # defined in the block will belong to the receiver. Any arguments passed to the
405
+ # method will be passed to the block. This can be used if the block needs to
406
+ # access instance variables.
407
+ #
408
+ # class Thing
409
+ # end
410
+ # Thing.class_exec{
411
+ # def hello() "Hello there!" end
412
+ # }
413
+ # puts Thing.new.hello()
414
+ #
415
+ # <em>produces:</em>
416
+ #
417
+ # Hello there!
418
+ #
419
+ alias class_exec module_exec
420
+
421
+ # <!--
422
+ # rdoc-file=object.c
423
+ # - obj.class_variable_defined?(symbol) -> true or false
424
+ # - obj.class_variable_defined?(string) -> true or false
425
+ # -->
426
+ # Returns `true` if the given class variable is defined in *obj*. String
427
+ # arguments are converted to symbols.
428
+ #
429
+ # class Fred
430
+ # @@foo = 99
431
+ # end
432
+ # Fred.class_variable_defined?(:@@foo) #=> true
433
+ # Fred.class_variable_defined?(:@@bar) #=> false
434
+ #
435
+ def class_variable_defined?: (interned name) -> bool
436
+
437
+ # <!--
438
+ # rdoc-file=object.c
439
+ # - mod.class_variable_get(symbol) -> obj
440
+ # - mod.class_variable_get(string) -> obj
441
+ # -->
442
+ # Returns the value of the given class variable (or throws a NameError
443
+ # exception). The <code>@@</code> part of the variable name should be included
444
+ # for regular class variables. String arguments are converted to symbols.
445
+ #
446
+ # class Fred
447
+ # @@foo = 99
448
+ # end
449
+ # Fred.class_variable_get(:@@foo) #=> 99
450
+ #
451
+ def class_variable_get: (interned name) -> untyped
452
+
453
+ # <!--
454
+ # rdoc-file=object.c
455
+ # - obj.class_variable_set(symbol, obj) -> obj
456
+ # - obj.class_variable_set(string, obj) -> obj
457
+ # -->
458
+ # Sets the class variable named by *symbol* to the given object. If the class
459
+ # variable name is passed as a string, that string is converted to a symbol.
460
+ #
461
+ # class Fred
462
+ # @@foo = 99
463
+ # def foo
464
+ # @@foo
465
+ # end
466
+ # end
467
+ # Fred.class_variable_set(:@@foo, 101) #=> 101
468
+ # Fred.new.foo #=> 101
469
+ #
470
+ def class_variable_set: [T] (interned name, T value) -> T
471
+
472
+ # <!--
473
+ # rdoc-file=object.c
474
+ # - mod.class_variables(inherit=true) -> array
475
+ # -->
476
+ # Returns an array of the names of class variables in *mod*. This includes the
477
+ # names of class variables in any included modules, unless the *inherit*
478
+ # parameter is set to `false`.
479
+ #
480
+ # class One
481
+ # @@var1 = 1
482
+ # end
483
+ # class Two < One
484
+ # @@var2 = 2
485
+ # end
486
+ # One.class_variables #=> [:@@var1]
487
+ # Two.class_variables #=> [:@@var2, :@@var1]
488
+ # Two.class_variables(false) #=> [:@@var2]
489
+ #
490
+ def class_variables: (?boolish inherit) -> Array[Symbol]
491
+
492
+ # <!--
493
+ # rdoc-file=object.c
494
+ # - const_added(const_name)
495
+ # -->
496
+ # Invoked as a callback whenever a constant is assigned on the receiver
497
+ #
498
+ # module Chatty
499
+ # def self.const_added(const_name)
500
+ # super
501
+ # puts "Added #{const_name.inspect}"
502
+ # end
503
+ # FOO = 1
504
+ # end
505
+ #
506
+ # <em>produces:</em>
507
+ #
508
+ # Added :FOO
509
+ #
510
+ # If we define a class using the `class` keyword, `const_added` runs before
511
+ # `inherited`:
512
+ #
513
+ # module M
514
+ # def self.const_added(const_name)
515
+ # super
516
+ # p :const_added
517
+ # end
518
+ #
519
+ # parent = Class.new do
520
+ # def self.inherited(subclass)
521
+ # super
522
+ # p :inherited
523
+ # end
524
+ # end
525
+ #
526
+ # class Child < parent
527
+ # end
528
+ # end
529
+ #
530
+ # <em>produces:</em>
531
+ #
532
+ # :const_added
533
+ # :inherited
534
+ #
535
+ private def const_added: (Symbol const_name) -> void
536
+
537
+ # <!--
538
+ # rdoc-file=object.c
539
+ # - mod.const_defined?(sym, inherit=true) -> true or false
540
+ # - mod.const_defined?(str, inherit=true) -> true or false
541
+ # -->
542
+ # Says whether *mod* or its ancestors have a constant with the given name:
543
+ #
544
+ # Float.const_defined?(:EPSILON) #=> true, found in Float itself
545
+ # Float.const_defined?("String") #=> true, found in Object (ancestor)
546
+ # BasicObject.const_defined?(:Hash) #=> false
547
+ #
548
+ # If *mod* is a `Module`, additionally `Object` and its ancestors are checked:
549
+ #
550
+ # Math.const_defined?(:String) #=> true, found in Object
551
+ #
552
+ # In each of the checked classes or modules, if the constant is not present but
553
+ # there is an autoload for it, `true` is returned directly without autoloading:
554
+ #
555
+ # module Admin
556
+ # autoload :User, 'admin/user'
557
+ # end
558
+ # Admin.const_defined?(:User) #=> true
559
+ #
560
+ # If the constant is not found the callback `const_missing` is **not** called
561
+ # and the method returns `false`.
562
+ #
563
+ # If `inherit` is false, the lookup only checks the constants in the receiver:
564
+ #
565
+ # IO.const_defined?(:SYNC) #=> true, found in File::Constants (ancestor)
566
+ # IO.const_defined?(:SYNC, false) #=> false, not found in IO itself
567
+ #
568
+ # In this case, the same logic for autoloading applies.
569
+ #
570
+ # If the argument is not a valid constant name a `NameError` is raised with the
571
+ # message "wrong constant name *name*":
572
+ #
573
+ # Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
574
+ #
575
+ def const_defined?: (interned name, ?boolish inherit) -> bool
576
+
577
+ # <!--
578
+ # rdoc-file=object.c
579
+ # - mod.const_get(sym, inherit=true) -> obj
580
+ # - mod.const_get(str, inherit=true) -> obj
581
+ # -->
582
+ # Checks for a constant with the given name in *mod*. If `inherit` is set, the
583
+ # lookup will also search the ancestors (and `Object` if *mod* is a `Module`).
584
+ #
585
+ # The value of the constant is returned if a definition is found, otherwise a
586
+ # `NameError` is raised.
587
+ #
588
+ # Math.const_get(:PI) #=> 3.14159265358979
589
+ #
590
+ # This method will recursively look up constant names if a namespaced class name
591
+ # is provided. For example:
592
+ #
593
+ # module Foo; class Bar; end end
594
+ # Object.const_get 'Foo::Bar'
595
+ #
596
+ # The `inherit` flag is respected on each lookup. For example:
597
+ #
598
+ # module Foo
599
+ # class Bar
600
+ # VAL = 10
601
+ # end
602
+ #
603
+ # class Baz < Bar; end
604
+ # end
605
+ #
606
+ # Object.const_get 'Foo::Baz::VAL' # => 10
607
+ # Object.const_get 'Foo::Baz::VAL', false # => NameError
608
+ #
609
+ # If the argument is not a valid constant name a `NameError` will be raised with
610
+ # a warning "wrong constant name".
611
+ #
612
+ # Object.const_get 'foobar' #=> NameError: wrong constant name foobar
613
+ #
614
+ def const_get: (interned name, ?boolish inherit) -> untyped
615
+
616
+ # <!--
617
+ # rdoc-file=object.c
618
+ # - mod.const_missing(sym) -> obj
619
+ # -->
620
+ # Invoked when a reference is made to an undefined constant in *mod*. It is
621
+ # passed a symbol for the undefined constant, and returns a value to be used for
622
+ # that constant. For example, consider:
623
+ #
624
+ # def Foo.const_missing(name)
625
+ # name # return the constant name as Symbol
626
+ # end
627
+ #
628
+ # Foo::UNDEFINED_CONST #=> :UNDEFINED_CONST: symbol returned
629
+ #
630
+ # As the example above shows, `const_missing` is not required to create the
631
+ # missing constant in *mod*, though that is often a side-effect. The caller gets
632
+ # its return value when triggered. If the constant is also defined, further
633
+ # lookups won't hit `const_missing` and will return the value stored in the
634
+ # constant as usual. Otherwise, `const_missing` will be invoked again.
635
+ #
636
+ # In the next example, when a reference is made to an undefined constant,
637
+ # `const_missing` attempts to load a file whose path is the lowercase version of
638
+ # the constant name (thus class `Fred` is assumed to be in file
639
+ # <code>fred.rb</code>). If defined as a side-effect of loading the file, the
640
+ # method returns the value stored in the constant. This implements an autoload
641
+ # feature similar to Kernel#autoload and Module#autoload, though it differs in
642
+ # important ways.
643
+ #
644
+ # def Object.const_missing(name)
645
+ # @looked_for ||= {}
646
+ # str_name = name.to_s
647
+ # raise "Constant not found: #{name}" if @looked_for[str_name]
648
+ # @looked_for[str_name] = 1
649
+ # file = str_name.downcase
650
+ # require file
651
+ # const_get(name, false)
652
+ # end
653
+ #
654
+ def const_missing: (Symbol name) -> untyped
655
+
656
+ # <!--
657
+ # rdoc-file=object.c
658
+ # - mod.const_set(sym, obj) -> obj
659
+ # - mod.const_set(str, obj) -> obj
660
+ # -->
661
+ # Sets the named constant to the given object, returning that object. Creates a
662
+ # new constant if no constant with the given name previously existed.
663
+ #
664
+ # Math.const_set("HIGH_SCHOOL_PI", 22.0/7.0) #=> 3.14285714285714
665
+ # Math::HIGH_SCHOOL_PI - Math::PI #=> 0.00126448926734968
666
+ #
667
+ # If `sym` or `str` is not a valid constant name a `NameError` will be raised
668
+ # with a warning "wrong constant name".
669
+ #
670
+ # Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
671
+ #
672
+ def const_set: [T] (interned name, T value) -> T
673
+
674
+ # <!--
675
+ # rdoc-file=object.c
676
+ # - mod.const_source_location(sym, inherit=true) -> [String, Integer]
677
+ # - mod.const_source_location(str, inherit=true) -> [String, Integer]
678
+ # -->
679
+ # Returns the Ruby source filename and line number containing the definition of
680
+ # the constant specified. If the named constant is not found, `nil` is returned.
681
+ # If the constant is found, but its source location can not be extracted
682
+ # (constant is defined in C code), empty array is returned.
683
+ #
684
+ # *inherit* specifies whether to lookup in <code>mod.ancestors</code> (`true` by
685
+ # default).
686
+ #
687
+ # # test.rb:
688
+ # class A # line 1
689
+ # C1 = 1
690
+ # C2 = 2
691
+ # end
692
+ #
693
+ # module M # line 6
694
+ # C3 = 3
695
+ # end
696
+ #
697
+ # class B < A # line 10
698
+ # include M
699
+ # C4 = 4
700
+ # end
701
+ #
702
+ # class A # continuation of A definition
703
+ # C2 = 8 # constant redefinition; warned yet allowed
704
+ # end
705
+ #
706
+ # p B.const_source_location('C4') # => ["test.rb", 12]
707
+ # p B.const_source_location('C3') # => ["test.rb", 7]
708
+ # p B.const_source_location('C1') # => ["test.rb", 2]
709
+ #
710
+ # p B.const_source_location('C3', false) # => nil -- don't lookup in ancestors
711
+ #
712
+ # p A.const_source_location('C2') # => ["test.rb", 16] -- actual (last) definition place
713
+ #
714
+ # p Object.const_source_location('B') # => ["test.rb", 10] -- top-level constant could be looked through Object
715
+ # p Object.const_source_location('A') # => ["test.rb", 1] -- class reopening is NOT considered new definition
716
+ #
717
+ # p B.const_source_location('A') # => ["test.rb", 1] -- because Object is in ancestors
718
+ # p M.const_source_location('A') # => ["test.rb", 1] -- Object is not ancestor, but additionally checked for modules
719
+ #
720
+ # p Object.const_source_location('A::C1') # => ["test.rb", 2] -- nesting is supported
721
+ # p Object.const_source_location('String') # => [] -- constant is defined in C code
722
+ #
723
+ def const_source_location: (interned name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
724
+
725
+ # <!--
726
+ # rdoc-file=object.c
727
+ # - mod.constants(inherit=true) -> array
728
+ # -->
729
+ # Returns an array of the names of the constants accessible in *mod*. This
730
+ # includes the names of constants in any included modules (example at start of
731
+ # section), unless the *inherit* parameter is set to `false`.
732
+ #
733
+ # The implementation makes no guarantees about the order in which the constants
734
+ # are yielded.
735
+ #
736
+ # IO.constants.include?(:SYNC) #=> true
737
+ # IO.constants(false).include?(:SYNC) #=> false
738
+ #
739
+ # Also see Module#const_defined?.
740
+ #
741
+ def constants: (?boolish inherit) -> Array[Symbol]
742
+
743
+ # <!--
744
+ # rdoc-file=proc.c
745
+ # - define_method(symbol, method) -> symbol
746
+ # - define_method(symbol) { block } -> symbol
747
+ # -->
748
+ # Defines an instance method in the receiver. The *method* parameter can be a
749
+ # `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified, it
750
+ # is used as the method body. If a block or the *method* parameter has
751
+ # parameters, they're used as method parameters. This block is evaluated using
752
+ # #instance_eval.
753
+ #
754
+ # class A
755
+ # def fred
756
+ # puts "In Fred"
757
+ # end
758
+ # def create_method(name, &block)
759
+ # self.class.define_method(name, &block)
760
+ # end
761
+ # define_method(:wilma) { puts "Charge it!" }
762
+ # define_method(:flint) {|name| puts "I'm #{name}!"}
763
+ # end
764
+ # class B < A
765
+ # define_method(:barney, instance_method(:fred))
766
+ # end
767
+ # a = B.new
768
+ # a.barney
769
+ # a.wilma
770
+ # a.flint('Dino')
771
+ # a.create_method(:betty) { p self }
772
+ # a.betty
773
+ #
774
+ # <em>produces:</em>
775
+ #
776
+ # In Fred
777
+ # Charge it!
778
+ # I'm Dino!
779
+ # #<B:0x401b39e8>
780
+ #
781
+ def define_method: (interned symbol, ^(?) [self: top] -> untyped | Method | UnboundMethod method) -> Symbol
782
+ | (interned symbol) { (?) [self: top] -> untyped } -> Symbol
783
+
784
+ # <!--
785
+ # rdoc-file=object.c
786
+ # - mod.deprecate_constant(symbol, ...) => mod
787
+ # -->
788
+ # Makes a list of existing constants deprecated. Attempt to refer to them will
789
+ # produce a warning.
790
+ #
791
+ # module HTTP
792
+ # NotFound = Exception.new
793
+ # NOT_FOUND = NotFound # previous version of the library used this name
794
+ #
795
+ # deprecate_constant :NOT_FOUND
796
+ # end
797
+ #
798
+ # HTTP::NOT_FOUND
799
+ # # warning: constant HTTP::NOT_FOUND is deprecated
800
+ #
801
+ def deprecate_constant: (*interned names) -> self
802
+
803
+ def equal?: (untyped other) -> bool
804
+
805
+ # <!--
806
+ # rdoc-file=eval.c
807
+ # - extend_object(obj) -> obj
808
+ # -->
809
+ # Extends the specified object by adding this module's constants and methods
810
+ # (which are added as singleton methods). This is the callback method used by
811
+ # Object#extend.
812
+ #
813
+ # module Picky
814
+ # def Picky.extend_object(o)
815
+ # if String === o
816
+ # puts "Can't add Picky to a String"
817
+ # else
818
+ # puts "Picky added to #{o.class}"
819
+ # super
820
+ # end
821
+ # end
822
+ # end
823
+ # (s = Array.new).extend Picky # Call Object.extend
824
+ # (s = "quick brown fox").extend Picky
825
+ #
826
+ # <em>produces:</em>
827
+ #
828
+ # Picky added to Array
829
+ # Can't add Picky to a String
830
+ #
831
+ private def extend_object: [T] (T object) -> T
832
+
833
+ # <!--
834
+ # rdoc-file=object.c
835
+ # - extended(othermod)
836
+ # -->
837
+ # The equivalent of `included`, but for extended modules.
838
+ #
839
+ # module A
840
+ # def self.extended(mod)
841
+ # puts "#{self} extended in #{mod}"
842
+ # end
843
+ # end
844
+ # module Enumerable
845
+ # extend A
846
+ # end
847
+ # # => prints "A extended in Enumerable"
848
+ #
849
+ private def extended: (untyped othermod) -> void
850
+
851
+ # <!--
852
+ # rdoc-file=object.c
853
+ # - mod.freeze -> mod
854
+ # -->
855
+ # Prevents further modifications to *mod*.
856
+ #
857
+ # This method returns self.
858
+ #
859
+ def freeze: () -> self
860
+
861
+ # <!--
862
+ # rdoc-file=eval.c
863
+ # - include(module, ...) -> self
864
+ # -->
865
+ # Invokes Module.append_features on each parameter in reverse order.
866
+ #
867
+ def include: (Module module, *Module additional_modules) -> self
868
+
869
+ # <!--
870
+ # rdoc-file=object.c
871
+ # - mod.include?(module) -> true or false
872
+ # -->
873
+ # Returns `true` if *module* is included or prepended in *mod* or one of *mod*'s
874
+ # ancestors.
875
+ #
876
+ # module A
877
+ # end
878
+ # class B
879
+ # include A
880
+ # end
881
+ # class C < B
882
+ # end
883
+ # B.include?(A) #=> true
884
+ # C.include?(A) #=> true
885
+ # A.include?(A) #=> false
886
+ #
887
+ def include?: (Module arg0) -> bool
888
+
889
+ # <!--
890
+ # rdoc-file=object.c
891
+ # - included(othermod)
892
+ # -->
893
+ # Callback invoked whenever the receiver is included in another module or class.
894
+ # This should be used in preference to <code>Module.append_features</code> if
895
+ # your code wants to perform some action when a module is included in another.
896
+ #
897
+ # module A
898
+ # def A.included(mod)
899
+ # puts "#{self} included in #{mod}"
900
+ # end
901
+ # end
902
+ # module Enumerable
903
+ # include A
904
+ # end
905
+ # # => prints "A included in Enumerable"
906
+ #
907
+ private def included: (Module othermod) -> void
908
+
909
+ # <!--
910
+ # rdoc-file=object.c
911
+ # - mod.included_modules -> array
912
+ # -->
913
+ # Returns the list of modules included or prepended in *mod* or one of *mod*'s
914
+ # ancestors.
915
+ #
916
+ # module Sub
917
+ # end
918
+ #
919
+ # module Mixin
920
+ # prepend Sub
921
+ # end
922
+ #
923
+ # module Outer
924
+ # include Mixin
925
+ # end
926
+ #
927
+ # Mixin.included_modules #=> [Sub]
928
+ # Outer.included_modules #=> [Sub, Mixin]
929
+ #
930
+ def included_modules: () -> Array[Module]
931
+
932
+ # <!--
933
+ # rdoc-file=object.c
934
+ # - Module.new -> mod
935
+ # - Module.new {|mod| block } -> mod
936
+ # -->
937
+ # Creates a new anonymous module. If a block is given, it is passed the module
938
+ # object, and the block is evaluated in the context of this module like
939
+ # #module_eval.
940
+ #
941
+ # fred = Module.new do
942
+ # def meth1
943
+ # "hello"
944
+ # end
945
+ # def meth2
946
+ # "bye"
947
+ # end
948
+ # end
949
+ # a = "my string"
950
+ # a.extend(fred) #=> "my string"
951
+ # a.meth1 #=> "hello"
952
+ # a.meth2 #=> "bye"
953
+ #
954
+ # Assign the module to a constant (name starting uppercase) if you want to treat
955
+ # it like a regular module.
956
+ #
957
+ def initialize: () ?{ (Module mod) [self: self] -> void } -> void
958
+
959
+ def initialize_clone: (Module source, ?freeze: bool?) -> void
960
+
961
+ # <!--
962
+ # rdoc-file=proc.c
963
+ # - mod.instance_method(symbol) -> unbound_method
964
+ # -->
965
+ # Returns an `UnboundMethod` representing the given instance method in *mod*.
966
+ #
967
+ # class Interpreter
968
+ # def do_a() print "there, "; end
969
+ # def do_d() print "Hello "; end
970
+ # def do_e() print "!\n"; end
971
+ # def do_v() print "Dave"; end
972
+ # Dispatcher = {
973
+ # "a" => instance_method(:do_a),
974
+ # "d" => instance_method(:do_d),
975
+ # "e" => instance_method(:do_e),
976
+ # "v" => instance_method(:do_v)
977
+ # }
978
+ # def interpret(string)
979
+ # string.each_char {|b| Dispatcher[b].bind(self).call }
980
+ # end
981
+ # end
982
+ #
983
+ # interpreter = Interpreter.new
984
+ # interpreter.interpret('dave')
985
+ #
986
+ # <em>produces:</em>
987
+ #
988
+ # Hello there, Dave!
989
+ #
990
+ def instance_method: (interned name) -> UnboundMethod
991
+
992
+ # <!--
993
+ # rdoc-file=object.c
994
+ # - mod.instance_methods(include_super=true) -> array
995
+ # -->
996
+ # Returns an array containing the names of the public and protected instance
997
+ # methods in the receiver. For a module, these are the public and protected
998
+ # methods; for a class, they are the instance (not singleton) methods. If the
999
+ # optional parameter is `false`, the methods of any ancestors are not included.
1000
+ #
1001
+ # module A
1002
+ # def method1() end
1003
+ # end
1004
+ # class B
1005
+ # include A
1006
+ # def method2() end
1007
+ # end
1008
+ # class C < B
1009
+ # def method3() end
1010
+ # end
1011
+ #
1012
+ # A.instance_methods(false) #=> [:method1]
1013
+ # B.instance_methods(false) #=> [:method2]
1014
+ # B.instance_methods(true).include?(:method1) #=> true
1015
+ # C.instance_methods(false) #=> [:method3]
1016
+ # C.instance_methods.include?(:method2) #=> true
1017
+ #
1018
+ # Note that method visibility changes in the current class, as well as aliases,
1019
+ # are considered as methods of the current class by this method:
1020
+ #
1021
+ # class C < B
1022
+ # alias method4 method2
1023
+ # protected :method2
1024
+ # end
1025
+ # C.instance_methods(false).sort #=> [:method2, :method3, :method4]
1026
+ #
1027
+ def instance_methods: (?boolish include_super) -> Array[Symbol]
1028
+
1029
+ # <!--
1030
+ # rdoc-file=object.c
1031
+ # - method_added(method_name)
1032
+ # -->
1033
+ # Invoked as a callback whenever an instance method is added to the receiver.
1034
+ #
1035
+ # module Chatty
1036
+ # def self.method_added(method_name)
1037
+ # puts "Adding #{method_name.inspect}"
1038
+ # end
1039
+ # def self.some_class_method() end
1040
+ # def some_instance_method() end
1041
+ # end
1042
+ #
1043
+ # <em>produces:</em>
1044
+ #
1045
+ # Adding :some_instance_method
1046
+ #
1047
+ private def method_added: (Symbol method_name) -> void
1048
+
1049
+ # <!--
1050
+ # rdoc-file=vm_method.c
1051
+ # - mod.method_defined?(symbol, inherit=true) -> true or false
1052
+ # - mod.method_defined?(string, inherit=true) -> true or false
1053
+ # -->
1054
+ # Returns `true` if the named method is defined by *mod*. If *inherit* is set,
1055
+ # the lookup will also search *mod*'s ancestors. Public and protected methods
1056
+ # are matched. String arguments are converted to symbols.
1057
+ #
1058
+ # module A
1059
+ # def method1() end
1060
+ # def protected_method1() end
1061
+ # protected :protected_method1
1062
+ # end
1063
+ # class B
1064
+ # def method2() end
1065
+ # def private_method2() end
1066
+ # private :private_method2
1067
+ # end
1068
+ # class C < B
1069
+ # include A
1070
+ # def method3() end
1071
+ # end
1072
+ #
1073
+ # A.method_defined? :method1 #=> true
1074
+ # C.method_defined? "method1" #=> true
1075
+ # C.method_defined? "method2" #=> true
1076
+ # C.method_defined? "method2", true #=> true
1077
+ # C.method_defined? "method2", false #=> false
1078
+ # C.method_defined? "method3" #=> true
1079
+ # C.method_defined? "protected_method1" #=> true
1080
+ # C.method_defined? "method4" #=> false
1081
+ # C.method_defined? "private_method2" #=> false
1082
+ #
1083
+ def method_defined?: (interned name, ?boolish inherit) -> bool
1084
+
1085
+ # <!--
1086
+ # rdoc-file=object.c
1087
+ # - method_removed(method_name)
1088
+ # -->
1089
+ # Invoked as a callback whenever an instance method is removed from the
1090
+ # receiver.
1091
+ #
1092
+ # module Chatty
1093
+ # def self.method_removed(method_name)
1094
+ # puts "Removing #{method_name.inspect}"
1095
+ # end
1096
+ # def self.some_class_method() end
1097
+ # def some_instance_method() end
1098
+ # class << self
1099
+ # remove_method :some_class_method
1100
+ # end
1101
+ # remove_method :some_instance_method
1102
+ # end
1103
+ #
1104
+ # <em>produces:</em>
1105
+ #
1106
+ # Removing :some_instance_method
1107
+ #
1108
+ private def method_removed: (Symbol method_name) -> void
1109
+
1110
+ # <!--
1111
+ # rdoc-file=object.c
1112
+ # - method_undefined(method_name)
1113
+ # -->
1114
+ # Invoked as a callback whenever an instance method is undefined from the
1115
+ # receiver.
1116
+ #
1117
+ # module Chatty
1118
+ # def self.method_undefined(method_name)
1119
+ # puts "Undefining #{method_name.inspect}"
1120
+ # end
1121
+ # def self.some_class_method() end
1122
+ # def some_instance_method() end
1123
+ # class << self
1124
+ # undef_method :some_class_method
1125
+ # end
1126
+ # undef_method :some_instance_method
1127
+ # end
1128
+ #
1129
+ # <em>produces:</em>
1130
+ #
1131
+ # Undefining :some_instance_method
1132
+ #
1133
+ private def method_undefined: (Symbol method_name) -> void
1134
+
1135
+ # <!--
1136
+ # rdoc-file=vm_eval.c
1137
+ # - mod.class_eval(string [, filename [, lineno]]) -> obj
1138
+ # - mod.class_eval {|mod| block } -> obj
1139
+ # - mod.module_eval(string [, filename [, lineno]]) -> obj
1140
+ # - mod.module_eval {|mod| block } -> obj
1141
+ # -->
1142
+ # Evaluates the string or block in the context of *mod*, except that when a
1143
+ # block is given, constant/class variable lookup is not affected. This can be
1144
+ # used to add methods to a class. `module_eval` returns the result of evaluating
1145
+ # its argument. The optional *filename* and *lineno* parameters set the text for
1146
+ # error messages.
1147
+ #
1148
+ # class Thing
1149
+ # end
1150
+ # a = %q{def hello() "Hello there!" end}
1151
+ # Thing.module_eval(a)
1152
+ # puts Thing.new.hello()
1153
+ # Thing.module_eval("invalid code", "dummy", 123)
1154
+ #
1155
+ # <em>produces:</em>
1156
+ #
1157
+ # Hello there!
1158
+ # dummy:123:in `module_eval': undefined local variable
1159
+ # or method `code' for Thing:Class
1160
+ #
1161
+ def module_eval: (string code, ?string? filename, ?int lineno) -> untyped
1162
+ | [U] () { (self mod) [self: self] -> U } -> U
1163
+
1164
+ # <!--
1165
+ # rdoc-file=vm_eval.c
1166
+ # - mod.module_exec(arg...) {|var...| block } -> obj
1167
+ # - mod.class_exec(arg...) {|var...| block } -> obj
1168
+ # -->
1169
+ # Evaluates the given block in the context of the class/module. The method
1170
+ # defined in the block will belong to the receiver. Any arguments passed to the
1171
+ # method will be passed to the block. This can be used if the block needs to
1172
+ # access instance variables.
1173
+ #
1174
+ # class Thing
1175
+ # end
1176
+ # Thing.class_exec{
1177
+ # def hello() "Hello there!" end
1178
+ # }
1179
+ # puts Thing.new.hello()
1180
+ #
1181
+ # <em>produces:</em>
1182
+ #
1183
+ # Hello there!
1184
+ #
1185
+ def module_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
1186
+
1187
+ # <!--
1188
+ # rdoc-file=vm_method.c
1189
+ # - module_function -> nil
1190
+ # - module_function(method_name) -> method_name
1191
+ # - module_function(method_name, method_name, ...) -> array
1192
+ # -->
1193
+ # Creates module functions for the named methods. These functions may be called
1194
+ # with the module as a receiver, and also become available as instance methods
1195
+ # to classes that mix in the module. Module functions are copies of the
1196
+ # original, and so may be changed independently. The instance-method versions
1197
+ # are made private. If used with no arguments, subsequently defined methods
1198
+ # become module functions. String arguments are converted to symbols. If a
1199
+ # single argument is passed, it is returned. If no argument is passed, nil is
1200
+ # returned. If multiple arguments are passed, the arguments are returned as an
1201
+ # array.
1202
+ #
1203
+ # module Mod
1204
+ # def one
1205
+ # "This is one"
1206
+ # end
1207
+ # module_function :one
1208
+ # end
1209
+ # class Cls
1210
+ # include Mod
1211
+ # def call_one
1212
+ # one
1213
+ # end
1214
+ # end
1215
+ # Mod.one #=> "This is one"
1216
+ # c = Cls.new
1217
+ # c.call_one #=> "This is one"
1218
+ # module Mod
1219
+ # def one
1220
+ # "This is the new one"
1221
+ # end
1222
+ # end
1223
+ # Mod.one #=> "This is one"
1224
+ # c.call_one #=> "This is the new one"
1225
+ #
1226
+ private def module_function: () -> nil
1227
+ | (Symbol method_name) -> Symbol
1228
+ | [T < _ToStr] (T method_name) -> T
1229
+ | (interned method_name) -> interned
1230
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1231
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1232
+ | (interned, interned, *interned method_names) -> Array[interned]
1233
+
1234
+ # <!--
1235
+ # rdoc-file=object.c
1236
+ # - mod.name -> string or nil
1237
+ # -->
1238
+ # Returns the name of the module *mod*. Returns `nil` for anonymous modules.
1239
+ #
1240
+ def name: %a{implicitly-returns-nil} () -> String
1241
+
1242
+ # <!--
1243
+ # rdoc-file=eval.c
1244
+ # - prepend(module, ...) -> self
1245
+ # -->
1246
+ # Invokes Module.prepend_features on each parameter in reverse order.
1247
+ #
1248
+ def prepend: (Module module, *Module additional_modules) -> self
1249
+
1250
+ # <!--
1251
+ # rdoc-file=eval.c
1252
+ # - prepend_features(mod) -> mod
1253
+ # -->
1254
+ # When this module is prepended in another, Ruby calls #prepend_features in this
1255
+ # module, passing it the receiving module in *mod*. Ruby's default
1256
+ # implementation is to overlay the constants, methods, and module variables of
1257
+ # this module to *mod* if this module has not already been added to *mod* or one
1258
+ # of its ancestors. See also Module#prepend.
1259
+ #
1260
+ private def prepend_features: (Module mod) -> self
1261
+
1262
+ # <!--
1263
+ # rdoc-file=object.c
1264
+ # - prepended(othermod)
1265
+ # -->
1266
+ # The equivalent of `included`, but for prepended modules.
1267
+ #
1268
+ # module A
1269
+ # def self.prepended(mod)
1270
+ # puts "#{self} prepended to #{mod}"
1271
+ # end
1272
+ # end
1273
+ # module Enumerable
1274
+ # prepend A
1275
+ # end
1276
+ # # => prints "A prepended to Enumerable"
1277
+ #
1278
+ private def prepended: (Module othermod) -> void
1279
+
1280
+ # <!--
1281
+ # rdoc-file=vm_method.c
1282
+ # - private -> nil
1283
+ # - private(method_name) -> method_name
1284
+ # - private(method_name, method_name, ...) -> array
1285
+ # - private(array) -> array
1286
+ # -->
1287
+ # With no arguments, sets the default visibility for subsequently defined
1288
+ # methods to private. With arguments, sets the named methods to have private
1289
+ # visibility. String arguments are converted to symbols. An Array of Symbols
1290
+ # and/or Strings is also accepted. If a single argument is passed, it is
1291
+ # returned. If no argument is passed, nil is returned. If multiple arguments are
1292
+ # passed, the arguments are returned as an array.
1293
+ #
1294
+ # module Mod
1295
+ # def a() end
1296
+ # def b() end
1297
+ # private
1298
+ # def c() end
1299
+ # private :a
1300
+ # end
1301
+ # Mod.private_instance_methods #=> [:a, :c]
1302
+ #
1303
+ # Note that to show a private method on RDoc, use <code>:doc:</code>.
1304
+ #
1305
+ private def private: () -> nil
1306
+ | (Symbol method_name) -> Symbol
1307
+ | [T < _ToStr] (T method_name) -> T
1308
+ | (interned method_name) -> interned
1309
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1310
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1311
+ | (interned, interned, *interned method_names) -> Array[interned]
1312
+ | (Array[Symbol] method_names) -> Array[Symbol]
1313
+ | [T < _ToStr] (Array[T] method_names) -> Array[T]
1314
+ | (Array[interned] method_names) -> Array[interned]
1315
+
1316
+ # <!--
1317
+ # rdoc-file=vm_method.c
1318
+ # - mod.private_class_method(symbol, ...) -> mod
1319
+ # - mod.private_class_method(string, ...) -> mod
1320
+ # - mod.private_class_method(array) -> mod
1321
+ # -->
1322
+ # Makes existing class methods private. Often used to hide the default
1323
+ # constructor `new`.
1324
+ #
1325
+ # String arguments are converted to symbols. An Array of Symbols and/or Strings
1326
+ # is also accepted.
1327
+ #
1328
+ # class SimpleSingleton # Not thread safe
1329
+ # private_class_method :new
1330
+ # def SimpleSingleton.create(*args, &block)
1331
+ # @me = new(*args, &block) if ! @me
1332
+ # @me
1333
+ # end
1334
+ # end
1335
+ #
1336
+ def private_class_method: (*interned method_names) -> self
1337
+ | (Array[interned] method_names) -> self
1338
+
1339
+ # <!--
1340
+ # rdoc-file=object.c
1341
+ # - mod.private_constant(symbol, ...) => mod
1342
+ # -->
1343
+ # Makes a list of existing constants private.
1344
+ #
1345
+ def private_constant: (*interned names) -> self
1346
+
1347
+ # <!--
1348
+ # rdoc-file=object.c
1349
+ # - mod.private_instance_methods(include_super=true) -> array
1350
+ # -->
1351
+ # Returns a list of the private instance methods defined in *mod*. If the
1352
+ # optional parameter is `false`, the methods of any ancestors are not included.
1353
+ #
1354
+ # module Mod
1355
+ # def method1() end
1356
+ # private :method1
1357
+ # def method2() end
1358
+ # end
1359
+ # Mod.instance_methods #=> [:method2]
1360
+ # Mod.private_instance_methods #=> [:method1]
1361
+ #
1362
+ def private_instance_methods: (?boolish include_super) -> Array[Symbol]
1363
+
1364
+ # <!--
1365
+ # rdoc-file=vm_method.c
1366
+ # - mod.private_method_defined?(symbol, inherit=true) -> true or false
1367
+ # - mod.private_method_defined?(string, inherit=true) -> true or false
1368
+ # -->
1369
+ # Returns `true` if the named private method is defined by *mod*. If *inherit*
1370
+ # is set, the lookup will also search *mod*'s ancestors. String arguments are
1371
+ # converted to symbols.
1372
+ #
1373
+ # module A
1374
+ # def method1() end
1375
+ # end
1376
+ # class B
1377
+ # private
1378
+ # def method2() end
1379
+ # end
1380
+ # class C < B
1381
+ # include A
1382
+ # def method3() end
1383
+ # end
1384
+ #
1385
+ # A.method_defined? :method1 #=> true
1386
+ # C.private_method_defined? "method1" #=> false
1387
+ # C.private_method_defined? "method2" #=> true
1388
+ # C.private_method_defined? "method2", true #=> true
1389
+ # C.private_method_defined? "method2", false #=> false
1390
+ # C.method_defined? "method2" #=> false
1391
+ #
1392
+ def private_method_defined?: (interned name, ?boolish inherit) -> bool
1393
+
1394
+ # <!--
1395
+ # rdoc-file=vm_method.c
1396
+ # - protected -> nil
1397
+ # - protected(method_name) -> method_name
1398
+ # - protected(method_name, method_name, ...) -> array
1399
+ # - protected(array) -> array
1400
+ # -->
1401
+ # Sets the visibility of a section or of a list of method names as protected.
1402
+ # Accepts no arguments, a splat of method names (symbols or strings) or an array
1403
+ # of method names. Returns the arguments that it received.
1404
+ #
1405
+ # ## Important difference between protected in other languages
1406
+ #
1407
+ # Protected methods in Ruby are different from other languages such as Java,
1408
+ # where methods are marked as protected to give access to subclasses. In Ruby,
1409
+ # subclasses **already have access to all methods defined in the parent class**,
1410
+ # even private ones.
1411
+ #
1412
+ # Marking a method as protected allows **different objects of the same class**
1413
+ # to call it.
1414
+ #
1415
+ # One use case is for comparison methods, such as <code>==</code>, if we want to
1416
+ # expose a method for comparison between objects of the same class without
1417
+ # making the method public to objects of other classes.
1418
+ #
1419
+ # ## Performance considerations
1420
+ #
1421
+ # Protected methods are slower than others because they can't use inline cache.
1422
+ #
1423
+ # ## Example
1424
+ #
1425
+ # class Account
1426
+ # # Mark balance as protected, so that we can compare between accounts
1427
+ # # without making it public.
1428
+ # attr_reader :balance
1429
+ # protected :balance
1430
+ #
1431
+ # def initialize(balance)
1432
+ # @balance = balance
1433
+ # end
1434
+ #
1435
+ # def >(other)
1436
+ # # The invocation to `other.balance` is allowed because `other` is a
1437
+ # # different object of the same class (Account).
1438
+ # balance > other.balance
1439
+ # end
1440
+ # end
1441
+ #
1442
+ # account1 = Account.new(100)
1443
+ # account2 = Account.new(50)
1444
+ #
1445
+ # account1 > account2 # => true (works)
1446
+ # account1.balance # => NoMethodError (fails because balance is not public)
1447
+ #
1448
+ # To show a private method on RDoc, use <code>:doc:</code> instead of this.
1449
+ #
1450
+ private def protected: () -> nil
1451
+ | (Symbol method_name) -> Symbol
1452
+ | [T < _ToStr] (T method_name) -> T
1453
+ | (interned method_name) -> interned
1454
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1455
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1456
+ | (interned, interned, *interned method_names) -> Array[interned]
1457
+ | (Array[Symbol] method_names) -> Array[Symbol]
1458
+ | [T < _ToStr] (Array[T] method_names) -> Array[T]
1459
+ | (Array[interned] method_names) -> Array[interned]
1460
+
1461
+ # <!--
1462
+ # rdoc-file=object.c
1463
+ # - mod.protected_instance_methods(include_super=true) -> array
1464
+ # -->
1465
+ # Returns a list of the protected instance methods defined in *mod*. If the
1466
+ # optional parameter is `false`, the methods of any ancestors are not included.
1467
+ #
1468
+ def protected_instance_methods: (?boolish include_super) -> Array[Symbol]
1469
+
1470
+ # <!--
1471
+ # rdoc-file=vm_method.c
1472
+ # - mod.protected_method_defined?(symbol, inherit=true) -> true or false
1473
+ # - mod.protected_method_defined?(string, inherit=true) -> true or false
1474
+ # -->
1475
+ # Returns `true` if the named protected method is defined *mod*. If *inherit*
1476
+ # is set, the lookup will also search *mod*'s ancestors. String arguments are
1477
+ # converted to symbols.
1478
+ #
1479
+ # module A
1480
+ # def method1() end
1481
+ # end
1482
+ # class B
1483
+ # protected
1484
+ # def method2() end
1485
+ # end
1486
+ # class C < B
1487
+ # include A
1488
+ # def method3() end
1489
+ # end
1490
+ #
1491
+ # A.method_defined? :method1 #=> true
1492
+ # C.protected_method_defined? "method1" #=> false
1493
+ # C.protected_method_defined? "method2" #=> true
1494
+ # C.protected_method_defined? "method2", true #=> true
1495
+ # C.protected_method_defined? "method2", false #=> false
1496
+ # C.method_defined? "method2" #=> true
1497
+ #
1498
+ def protected_method_defined?: (interned name, ?boolish inherit) -> bool
1499
+
1500
+ # <!--
1501
+ # rdoc-file=vm_method.c
1502
+ # - public -> nil
1503
+ # - public(method_name) -> method_name
1504
+ # - public(method_name, method_name, ...) -> array
1505
+ # - public(array) -> array
1506
+ # -->
1507
+ # With no arguments, sets the default visibility for subsequently defined
1508
+ # methods to public. With arguments, sets the named methods to have public
1509
+ # visibility. String arguments are converted to symbols. An Array of Symbols
1510
+ # and/or Strings is also accepted. If a single argument is passed, it is
1511
+ # returned. If no argument is passed, nil is returned. If multiple arguments are
1512
+ # passed, the arguments are returned as an array.
1513
+ #
1514
+ private def public: () -> nil
1515
+ | (Symbol method_name) -> Symbol
1516
+ | [T < _ToStr] (T method_name) -> T
1517
+ | (interned method_name) -> interned
1518
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1519
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1520
+ | (interned, interned, *interned method_names) -> Array[interned]
1521
+ | (Array[Symbol] method_names) -> Array[Symbol]
1522
+ | [T < _ToStr] (Array[T] method_names) -> Array[T]
1523
+ | (Array[interned] method_names) -> Array[interned]
1524
+
1525
+ # <!--
1526
+ # rdoc-file=vm_method.c
1527
+ # - mod.public_class_method(symbol, ...) -> mod
1528
+ # - mod.public_class_method(string, ...) -> mod
1529
+ # - mod.public_class_method(array) -> mod
1530
+ # -->
1531
+ # Makes a list of existing class methods public.
1532
+ #
1533
+ # String arguments are converted to symbols. An Array of Symbols and/or Strings
1534
+ # is also accepted.
1535
+ #
1536
+ def public_class_method: (*interned method_names) -> self
1537
+ | (Array[interned] method_names) -> self
1538
+
1539
+ # <!--
1540
+ # rdoc-file=object.c
1541
+ # - mod.public_constant(symbol, ...) => mod
1542
+ # -->
1543
+ # Makes a list of existing constants public.
1544
+ #
1545
+ def public_constant: (*interned names) -> self
1546
+
1547
+ # <!--
1548
+ # rdoc-file=proc.c
1549
+ # - mod.public_instance_method(symbol) -> unbound_method
1550
+ # -->
1551
+ # Similar to *instance_method*, searches public method only.
1552
+ #
1553
+ def public_instance_method: (interned arg0) -> UnboundMethod
1554
+
1555
+ # <!--
1556
+ # rdoc-file=object.c
1557
+ # - mod.public_instance_methods(include_super=true) -> array
1558
+ # -->
1559
+ # Returns a list of the public instance methods defined in *mod*. If the
1560
+ # optional parameter is `false`, the methods of any ancestors are not included.
1561
+ #
1562
+ def public_instance_methods: (?boolish include_super) -> Array[Symbol]
1563
+
1564
+ # <!--
1565
+ # rdoc-file=vm_method.c
1566
+ # - mod.public_method_defined?(symbol, inherit=true) -> true or false
1567
+ # - mod.public_method_defined?(string, inherit=true) -> true or false
1568
+ # -->
1569
+ # Returns `true` if the named public method is defined by *mod*. If *inherit*
1570
+ # is set, the lookup will also search *mod*'s ancestors. String arguments are
1571
+ # converted to symbols.
1572
+ #
1573
+ # module A
1574
+ # def method1() end
1575
+ # end
1576
+ # class B
1577
+ # protected
1578
+ # def method2() end
1579
+ # end
1580
+ # class C < B
1581
+ # include A
1582
+ # def method3() end
1583
+ # end
1584
+ #
1585
+ # A.method_defined? :method1 #=> true
1586
+ # C.public_method_defined? "method1" #=> true
1587
+ # C.public_method_defined? "method1", true #=> true
1588
+ # C.public_method_defined? "method1", false #=> true
1589
+ # C.public_method_defined? "method2" #=> false
1590
+ # C.method_defined? "method2" #=> true
1591
+ #
1592
+ def public_method_defined?: (interned name, ?boolish inherit) -> bool
1593
+
1594
+ # <!--
1595
+ # rdoc-file=eval.c
1596
+ # - refine(mod) { block } -> module
1597
+ # -->
1598
+ # Refine *mod* in the receiver.
1599
+ #
1600
+ # Returns a module, where refined methods are defined.
1601
+ #
1602
+ private def refine: (Module mod) { () [self: Refinement] -> void } -> Refinement
1603
+
1604
+ # <!--
1605
+ # rdoc-file=eval.c
1606
+ # - refinements -> array
1607
+ # -->
1608
+ # Returns an array of `Refinement` defined within the receiver.
1609
+ #
1610
+ # module A
1611
+ # refine Integer do
1612
+ # end
1613
+ #
1614
+ # refine String do
1615
+ # end
1616
+ # end
1617
+ #
1618
+ # p A.refinements
1619
+ #
1620
+ # <em>produces:</em>
1621
+ #
1622
+ # [#<refinement:Integer@A>, #<refinement:String@A>]
1623
+ #
1624
+ def refinements: () -> Array[Refinement]
1625
+
1626
+ # <!--
1627
+ # rdoc-file=object.c
1628
+ # - remove_class_variable(sym) -> obj
1629
+ # -->
1630
+ # Removes the named class variable from the receiver, returning that variable's
1631
+ # value.
1632
+ #
1633
+ # class Example
1634
+ # @@var = 99
1635
+ # puts remove_class_variable(:@@var)
1636
+ # p(defined? @@var)
1637
+ # end
1638
+ #
1639
+ # <em>produces:</em>
1640
+ #
1641
+ # 99
1642
+ # nil
1643
+ #
1644
+ def remove_class_variable: (interned name) -> untyped
1645
+
1646
+ # <!--
1647
+ # rdoc-file=object.c
1648
+ # - remove_const(sym) -> obj
1649
+ # -->
1650
+ # Removes the definition of the given constant, returning that constant's
1651
+ # previous value. If that constant referred to a module, this will not change
1652
+ # that module's name and can lead to confusion.
1653
+ #
1654
+ private def remove_const: (interned name) -> untyped
1655
+
1656
+ # <!--
1657
+ # rdoc-file=vm_method.c
1658
+ # - remove_method(symbol) -> self
1659
+ # - remove_method(string) -> self
1660
+ # -->
1661
+ # Removes the method identified by *symbol* from the current class. For an
1662
+ # example, see Module#undef_method. String arguments are converted to symbols.
1663
+ #
1664
+ def remove_method: (*interned method_names) -> self
1665
+
1666
+ # <!--
1667
+ # rdoc-file=vm_method.c
1668
+ # - ruby2_keywords(method_name, ...) -> nil
1669
+ # -->
1670
+ # For the given method names, marks the method as passing keywords through a
1671
+ # normal argument splat. This should only be called on methods that accept an
1672
+ # argument splat (<code>*args</code>) but not explicit keywords or a keyword
1673
+ # splat. It marks the method such that if the method is called with keyword
1674
+ # arguments, the final hash argument is marked with a special flag such that if
1675
+ # it is the final element of a normal argument splat to another method call, and
1676
+ # that method call does not include explicit keywords or a keyword splat, the
1677
+ # final element is interpreted as keywords. In other words, keywords will be
1678
+ # passed through the method to other methods.
1679
+ #
1680
+ # This should only be used for methods that delegate keywords to another method,
1681
+ # and only for backwards compatibility with Ruby versions before 3.0. See
1682
+ # https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyw
1683
+ # ord-arguments-in-ruby-3-0/ for details on why `ruby2_keywords` exists and when
1684
+ # and how to use it.
1685
+ #
1686
+ # This method will probably be removed at some point, as it exists only for
1687
+ # backwards compatibility. As it does not exist in Ruby versions before 2.7,
1688
+ # check that the module responds to this method before calling it:
1689
+ #
1690
+ # module Mod
1691
+ # def foo(meth, *args, &block)
1692
+ # send(:"do_#{meth}", *args, &block)
1693
+ # end
1694
+ # ruby2_keywords(:foo) if respond_to?(:ruby2_keywords, true)
1695
+ # end
1696
+ #
1697
+ # However, be aware that if the `ruby2_keywords` method is removed, the behavior
1698
+ # of the `foo` method using the above approach will change so that the method
1699
+ # does not pass through keywords.
1700
+ #
1701
+ private def ruby2_keywords: (interned method_name, *interned more_method_names) -> nil
1702
+
1703
+ # <!--
1704
+ # rdoc-file=object.c
1705
+ # - mod.set_temporary_name(string) -> self
1706
+ # - mod.set_temporary_name(nil) -> self
1707
+ # -->
1708
+ # Sets the temporary name of the module. This name is reflected in introspection
1709
+ # of the module and the values that are related to it, such as instances,
1710
+ # constants, and methods.
1711
+ #
1712
+ # The name should be `nil` or a non-empty string that is not a valid constant
1713
+ # path (to avoid confusing between permanent and temporary names).
1714
+ #
1715
+ # The method can be useful to distinguish dynamically generated classes and
1716
+ # modules without assigning them to constants.
1717
+ #
1718
+ # If the module is given a permanent name by assigning it to a constant, the
1719
+ # temporary name is discarded. A temporary name can't be assigned to modules
1720
+ # that have a permanent name.
1721
+ #
1722
+ # If the given name is `nil`, the module becomes anonymous again.
1723
+ #
1724
+ # Example:
1725
+ #
1726
+ # m = Module.new # => #<Module:0x0000000102c68f38>
1727
+ # m.name #=> nil
1728
+ #
1729
+ # m.set_temporary_name("fake_name") # => fake_name
1730
+ # m.name #=> "fake_name"
1731
+ #
1732
+ # m.set_temporary_name(nil) # => #<Module:0x0000000102c68f38>
1733
+ # m.name #=> nil
1734
+ #
1735
+ # c = Class.new
1736
+ # c.set_temporary_name("MyClass(with description)") # => MyClass(with description)
1737
+ #
1738
+ # c.new # => #<MyClass(with description):0x0....>
1739
+ #
1740
+ # c::M = m
1741
+ # c::M.name #=> "MyClass(with description)::M"
1742
+ #
1743
+ # # Assigning to a constant replaces the name with a permanent one
1744
+ # C = c
1745
+ #
1746
+ # C.name #=> "C"
1747
+ # C::M.name #=> "C::M"
1748
+ # c.new # => #<C:0x0....>
1749
+ #
1750
+ def set_temporary_name: (string? name) -> self
1751
+
1752
+ # <!--
1753
+ # rdoc-file=object.c
1754
+ # - mod.singleton_class? -> true or false
1755
+ # -->
1756
+ # Returns `true` if *mod* is a singleton class or `false` if it is an ordinary
1757
+ # class or module.
1758
+ #
1759
+ # class C
1760
+ # end
1761
+ # C.singleton_class? #=> false
1762
+ # C.singleton_class.singleton_class? #=> true
1763
+ #
1764
+ def singleton_class?: () -> bool
1765
+
1766
+ # <!--
1767
+ # rdoc-file=object.c
1768
+ # - mod.to_s -> string
1769
+ # -->
1770
+ # Returns a string representing this module or class. For basic classes and
1771
+ # modules, this is the name. For singletons, we show information on the thing
1772
+ # we're attached to as well.
1773
+ #
1774
+ def to_s: () -> String
1775
+
1776
+ # <!--
1777
+ # rdoc-file=vm_method.c
1778
+ # - undef_method(symbol) -> self
1779
+ # - undef_method(string) -> self
1780
+ # -->
1781
+ # Prevents the current class from responding to calls to the named method.
1782
+ # Contrast this with `remove_method`, which deletes the method from the
1783
+ # particular class; Ruby will still search superclasses and mixed-in modules for
1784
+ # a possible receiver. String arguments are converted to symbols.
1785
+ #
1786
+ # class Parent
1787
+ # def hello
1788
+ # puts "In parent"
1789
+ # end
1790
+ # end
1791
+ # class Child < Parent
1792
+ # def hello
1793
+ # puts "In child"
1794
+ # end
1795
+ # end
1796
+ #
1797
+ # c = Child.new
1798
+ # c.hello
1799
+ #
1800
+ # class Child
1801
+ # remove_method :hello # remove from child, still in parent
1802
+ # end
1803
+ # c.hello
1804
+ #
1805
+ # class Child
1806
+ # undef_method :hello # prevent any calls to 'hello'
1807
+ # end
1808
+ # c.hello
1809
+ #
1810
+ # <em>produces:</em>
1811
+ #
1812
+ # In child
1813
+ # In parent
1814
+ # prog.rb:23: undefined method 'hello' for #<Child:0x401b3bb4> (NoMethodError)
1815
+ #
1816
+ def undef_method: (*interned arg0) -> self
1817
+
1818
+ # <!--
1819
+ # rdoc-file=object.c
1820
+ # - mod.undefined_instance_methods -> array
1821
+ # -->
1822
+ # Returns a list of the undefined instance methods defined in *mod*. The
1823
+ # undefined methods of any ancestors are not included.
1824
+ #
1825
+ def undefined_instance_methods: () -> Array[Symbol]
1826
+
1827
+ # <!--
1828
+ # rdoc-file=eval.c
1829
+ # - using(module) -> self
1830
+ # -->
1831
+ # Import class refinements from *module* into the current class or module
1832
+ # definition.
1833
+ #
1834
+ private def using: (Module mod) -> self
1835
+
1836
+ # <!-- rdoc-file=object.c -->
1837
+ # Returns a string representing this module or class. For basic classes and
1838
+ # modules, this is the name. For singletons, we show information on the thing
1839
+ # we're attached to as well.
1840
+ #
1841
+ alias inspect to_s
1842
+
1843
+ # <!--
1844
+ # rdoc-file=object.c
1845
+ # - attr(name, ...) -> array
1846
+ # - attr(name, true) -> array
1847
+ # - attr(name, false) -> array
1848
+ # -->
1849
+ # The first form is equivalent to #attr_reader. The second form is equivalent to
1850
+ # <code>attr_accessor(name)</code> but deprecated. The last form is equivalent
1851
+ # to <code>attr_reader(name)</code> but deprecated. Returns an array of defined
1852
+ # method names as symbols.
1853
+ #
1854
+ def attr: %a{deprecated} (interned name, bool create_writer) -> Array[Symbol]
1855
+ | (*interned names) -> Array[Symbol]
1856
+ end