rbs 2.8.4 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -4
- data/.github/workflows/comments.yml +11 -11
- data/.github/workflows/dependabot.yml +30 -0
- data/.github/workflows/ruby.yml +40 -49
- data/.github/workflows/typecheck.yml +36 -0
- data/.github/workflows/windows.yml +28 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +42 -2
- data/CHANGELOG.md +845 -1
- data/README.md +64 -4
- data/Rakefile +198 -18
- data/Steepfile +11 -11
- data/config.yml +311 -0
- data/core/array.rbs +2189 -1914
- data/core/basic_object.rbs +59 -84
- data/core/binding.rbs +7 -69
- data/core/builtin.rbs +210 -11
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +23 -25
- data/core/complex.rbs +449 -227
- data/core/constants.rbs +29 -21
- data/core/data.rbs +415 -0
- data/core/dir.rbs +698 -415
- data/core/encoding.rbs +468 -843
- data/core/enumerable.rbs +495 -455
- data/core/enumerator/product.rbs +92 -0
- data/core/enumerator.rbs +106 -9
- data/core/env.rbs +1 -1
- data/core/errno.rbs +506 -605
- data/core/errors.rbs +15 -17
- data/core/exception.rbs +361 -145
- data/core/false_class.rbs +39 -26
- data/core/fiber.rbs +121 -14
- data/core/file.rbs +1262 -320
- data/core/file_test.rbs +62 -45
- data/core/float.rbs +187 -208
- data/core/gc.rbs +446 -196
- data/core/global_variables.rbs +29 -29
- data/core/hash.rbs +242 -349
- data/core/integer.rbs +246 -308
- data/core/io/buffer.rbs +373 -122
- data/core/io/wait.rbs +29 -17
- data/core/io.rbs +1881 -1518
- data/core/kernel.rbs +2116 -1538
- data/core/marshal.rbs +24 -14
- data/core/match_data.rbs +413 -166
- data/core/math.rbs +531 -291
- data/core/method.rbs +101 -32
- data/core/module.rbs +228 -64
- data/core/nil_class.rbs +106 -47
- data/core/numeric.rbs +206 -292
- data/core/object.rbs +73 -1168
- data/core/object_space/weak_key_map.rbs +166 -0
- data/core/object_space.rbs +5 -3
- data/core/proc.rbs +280 -39
- data/core/process.rbs +1318 -658
- data/core/ractor.rbs +200 -134
- data/core/random.rbs +21 -4
- data/core/range.rbs +309 -153
- data/core/rational.rbs +4 -12
- data/core/rb_config.rbs +64 -43
- data/core/rbs/unnamed/argf.rbs +411 -147
- data/core/rbs/unnamed/env_class.rbs +137 -253
- data/core/rbs/unnamed/random.rbs +49 -26
- data/core/refinement.rbs +16 -1
- data/core/regexp.rbs +1568 -862
- data/core/ruby_vm.rbs +719 -7
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +69 -6
- data/core/rubygems/rubygems.rbs +71 -17
- data/core/rubygems/version.rbs +11 -7
- data/{stdlib/set/0 → core}/set.rbs +80 -91
- data/core/signal.rbs +14 -8
- data/core/string.rbs +1732 -1607
- data/core/struct.rbs +467 -95
- data/core/symbol.rbs +215 -245
- data/core/thread.rbs +133 -89
- data/core/thread_group.rbs +9 -9
- data/core/time.rbs +1141 -841
- data/core/trace_point.rbs +181 -121
- data/core/true_class.rbs +58 -32
- data/core/unbound_method.rbs +103 -30
- data/core/warning.rbs +50 -5
- data/docs/CONTRIBUTING.md +1 -1
- data/docs/architecture.md +110 -0
- data/docs/collection.md +59 -5
- data/docs/data_and_struct.md +86 -0
- data/docs/gem.md +57 -0
- data/docs/rbs_by_example.md +16 -35
- data/docs/repo.md +1 -1
- data/docs/sigs.md +7 -7
- data/docs/stdlib.md +63 -5
- data/docs/syntax.md +255 -61
- data/docs/tools.md +1 -0
- data/ext/rbs_extension/extconf.rb +10 -0
- data/ext/rbs_extension/lexer.c +1741 -1548
- data/ext/rbs_extension/lexer.h +11 -1
- data/ext/rbs_extension/lexer.re +12 -6
- data/ext/rbs_extension/lexstate.c +26 -3
- data/ext/rbs_extension/location.c +119 -111
- data/ext/rbs_extension/location.h +32 -7
- data/ext/rbs_extension/main.c +3 -0
- data/ext/rbs_extension/parser.c +883 -481
- data/ext/rbs_extension/parserstate.c +65 -25
- data/ext/rbs_extension/parserstate.h +13 -3
- data/ext/rbs_extension/rbs_extension.h +1 -10
- data/ext/rbs_extension/unescape.c +7 -47
- data/goodcheck.yml +2 -2
- data/{ext/rbs_extension → include/rbs}/constants.h +26 -15
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/formatter.rb +13 -3
- data/lib/rbs/annotate/rdoc_annotator.rb +1 -1
- data/lib/rbs/annotate/rdoc_source.rb +12 -3
- data/lib/rbs/ast/declarations.rb +85 -2
- data/lib/rbs/ast/directives.rb +39 -0
- data/lib/rbs/ast/members.rb +49 -15
- data/lib/rbs/ast/type_param.rb +104 -15
- data/lib/rbs/ast/visitor.rb +137 -0
- data/lib/rbs/buffer.rb +5 -0
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +83 -0
- data/lib/rbs/cli/validate.rb +356 -0
- data/lib/rbs/cli.rb +253 -143
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +92 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +154 -65
- data/lib/rbs/collection/config.rb +19 -46
- data/lib/rbs/collection/installer.rb +12 -13
- data/lib/rbs/collection/sources/base.rb +2 -2
- data/lib/rbs/collection/sources/git.rb +146 -69
- data/lib/rbs/collection/sources/local.rb +81 -0
- data/lib/rbs/collection/sources/rubygems.rb +10 -12
- data/lib/rbs/collection/sources/stdlib.rb +14 -13
- data/lib/rbs/collection/sources.rb +15 -2
- data/lib/rbs/collection.rb +2 -1
- data/lib/rbs/definition.rb +13 -16
- data/lib/rbs/definition_builder/ancestor_builder.rb +100 -24
- data/lib/rbs/definition_builder/method_builder.rb +4 -4
- data/lib/rbs/definition_builder.rb +489 -584
- data/lib/rbs/diff.rb +125 -0
- data/lib/rbs/environment/use_map.rb +77 -0
- data/lib/rbs/environment.rb +406 -105
- data/lib/rbs/environment_loader.rb +48 -44
- data/lib/rbs/environment_walker.rb +1 -1
- data/lib/rbs/errors.rb +175 -56
- data/lib/rbs/file_finder.rb +28 -0
- data/lib/rbs/location_aux.rb +8 -7
- data/lib/rbs/locator.rb +37 -15
- data/lib/rbs/method_type.rb +23 -0
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser/lex_result.rb +15 -0
- data/lib/rbs/parser/token.rb +23 -0
- data/lib/rbs/parser_aux.rb +22 -13
- data/lib/rbs/prototype/helpers.rb +48 -22
- data/lib/rbs/prototype/node_usage.rb +99 -0
- data/lib/rbs/prototype/rb.rb +125 -31
- data/lib/rbs/prototype/rbi.rb +49 -36
- data/lib/rbs/prototype/runtime/helpers.rb +59 -0
- data/lib/rbs/prototype/runtime/reflection.rb +19 -0
- data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
- data/lib/rbs/prototype/runtime.rb +273 -159
- data/lib/rbs/resolver/constant_resolver.rb +24 -8
- data/lib/rbs/resolver/type_name_resolver.rb +41 -7
- data/lib/rbs/sorter.rb +153 -123
- data/lib/rbs/substitution.rb +19 -0
- data/lib/rbs/subtractor.rb +201 -0
- data/lib/rbs/test/errors.rb +24 -11
- data/lib/rbs/test/guaranteed.rb +30 -0
- data/lib/rbs/test/hook.rb +45 -40
- data/lib/rbs/test/setup.rb +1 -1
- data/lib/rbs/test/tester.rb +1 -1
- data/lib/rbs/test/type_check.rb +120 -23
- data/lib/rbs/test.rb +6 -3
- data/lib/rbs/type_alias_dependency.rb +13 -3
- data/lib/rbs/type_alias_regularity.rb +21 -14
- data/lib/rbs/type_name.rb +18 -13
- data/lib/rbs/types.rb +352 -18
- data/lib/rbs/unit_test/convertibles.rb +176 -0
- data/lib/rbs/unit_test/spy.rb +136 -0
- data/lib/rbs/unit_test/type_assertions.rb +341 -0
- data/lib/rbs/unit_test/with_aliases.rb +143 -0
- data/lib/rbs/unit_test.rb +6 -0
- data/lib/rbs/validator.rb +55 -30
- data/lib/rbs/variance_calculator.rb +26 -23
- data/lib/rbs/vendorer.rb +3 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +69 -22
- data/lib/rbs.rb +7 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +5 -5
- data/rbs.gemspec +12 -2
- data/schema/decls.json +1 -1
- data/schema/members.json +15 -10
- data/sig/ancestor_builder.rbs +4 -0
- data/sig/ancestor_graph.rbs +22 -2
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/cli/colored_io.rbs +15 -0
- data/sig/cli/diff.rbs +21 -0
- data/sig/cli/validate.rbs +43 -0
- data/sig/cli.rbs +4 -0
- data/sig/collection/config/lockfile.rbs +74 -0
- data/sig/collection/config/lockfile_generator.rbs +66 -0
- data/sig/collection/config.rbs +5 -48
- data/sig/collection/installer.rbs +1 -1
- data/sig/collection/sources.rbs +105 -33
- data/sig/constant.rbs +1 -1
- data/sig/declarations.rbs +42 -3
- data/sig/definition.rbs +26 -10
- data/sig/definition_builder.rbs +103 -81
- data/sig/diff.rbs +28 -0
- data/sig/directives.rbs +61 -0
- data/sig/environment.rbs +175 -29
- data/sig/environment_loader.rbs +20 -18
- data/sig/errors.rbs +123 -2
- data/sig/file_finder.rbs +28 -0
- data/sig/location.rbs +0 -3
- data/sig/locator.rbs +14 -2
- data/sig/manifest.yaml +0 -1
- data/sig/members.rbs +32 -9
- data/sig/method_types.rbs +10 -4
- data/sig/namespace.rbs +2 -3
- data/sig/parser.rbs +55 -16
- data/sig/prototype/helpers.rbs +4 -0
- data/sig/prototype/node_usage.rbs +20 -0
- data/sig/prototype/rb.rbs +10 -2
- data/sig/prototype/rbi.rbs +2 -0
- data/sig/prototype/runtime.rbs +182 -0
- data/sig/rbs.rbs +1 -1
- data/sig/rdoc/rbs.rbs +4 -0
- data/sig/repository.rbs +7 -5
- data/sig/resolver/constant_resolver.rbs +3 -4
- data/sig/resolver/context.rbs +1 -1
- data/sig/resolver/type_name_resolver.rbs +5 -1
- data/sig/shims/bundler.rbs +38 -0
- data/sig/shims/rubygems.rbs +19 -0
- data/sig/sorter.rbs +23 -5
- data/sig/substitution.rbs +6 -0
- data/sig/subtractor.rbs +37 -0
- data/sig/test/errors.rbs +52 -0
- data/sig/test/guranteed.rbs +9 -0
- data/sig/test/type_check.rbs +19 -0
- data/sig/test.rbs +82 -0
- data/sig/type_alias_dependency.rbs +31 -0
- data/sig/type_alias_regularity.rbs +12 -6
- data/sig/type_param.rbs +45 -9
- data/sig/typename.rbs +8 -5
- data/sig/types.rbs +119 -12
- data/sig/unit_test/convertibles.rbs +154 -0
- data/sig/unit_test/spy.rbs +28 -0
- data/sig/unit_test/type_assertions.rbs +194 -0
- data/sig/unit_test/with_aliases.rbs +136 -0
- data/sig/use_map.rbs +35 -0
- data/sig/validator.rbs +12 -5
- data/sig/variance_calculator.rbs +3 -1
- data/sig/vendorer.rbs +1 -1
- data/sig/visitor.rbs +47 -0
- data/sig/writer.rbs +6 -2
- data/src/constants.c +153 -0
- data/src/ruby_objs.c +793 -0
- data/stdlib/base64/0/base64.rbs +298 -45
- data/stdlib/benchmark/0/benchmark.rbs +12 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +62 -198
- data/stdlib/cgi/0/core.rbs +68 -15
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/coverage/0/coverage.rbs +50 -11
- data/stdlib/csv/0/csv.rbs +90 -119
- data/stdlib/csv/0/manifest.yaml +1 -0
- data/stdlib/date/0/date.rbs +806 -735
- data/stdlib/date/0/date_time.rbs +70 -211
- data/stdlib/dbm/0/dbm.rbs +0 -2
- data/stdlib/delegate/0/delegator.rbs +184 -0
- data/stdlib/delegate/0/kernel.rbs +47 -0
- data/stdlib/delegate/0/simple_delegator.rbs +96 -0
- data/stdlib/did_you_mean/0/did_you_mean.rbs +3 -8
- data/stdlib/digest/0/digest.rbs +48 -35
- data/stdlib/erb/0/erb.rbs +15 -39
- data/stdlib/etc/0/etc.rbs +174 -54
- data/stdlib/fileutils/0/fileutils.rbs +1234 -385
- data/stdlib/forwardable/0/forwardable.rbs +4 -4
- data/stdlib/io-console/0/io-console.rbs +82 -17
- data/stdlib/ipaddr/0/ipaddr.rbs +11 -6
- data/stdlib/json/0/json.rbs +434 -151
- data/stdlib/kconv/0/kconv.rbs +166 -0
- data/stdlib/logger/0/formatter.rbs +0 -2
- data/stdlib/logger/0/log_device.rbs +1 -3
- data/stdlib/logger/0/logger.rbs +465 -328
- data/stdlib/minitest/0/kernel.rbs +2 -2
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
- data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
- data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
- data/stdlib/minitest/0/minitest/compress.rbs +13 -0
- data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
- data/stdlib/minitest/0/minitest/mock.rbs +9 -5
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
- data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
- data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
- data/stdlib/minitest/0/minitest/spec.rbs +1 -1
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +7 -7
- data/stdlib/minitest/0/minitest/test.rbs +7 -14
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit.rbs +1 -2
- data/stdlib/minitest/0/minitest.rbs +41 -892
- data/stdlib/monitor/0/monitor.rbs +91 -10
- data/stdlib/mutex_m/0/mutex_m.rbs +0 -2
- data/stdlib/net-http/0/manifest.yaml +1 -1
- data/stdlib/net-http/0/net-http.rbs +3858 -964
- data/stdlib/net-protocol/0/manifest.yaml +2 -0
- data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
- data/stdlib/net-smtp/0/manifest.yaml +2 -0
- data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
- data/stdlib/nkf/0/nkf.rbs +35 -5
- data/stdlib/objspace/0/objspace.rbs +40 -18
- data/stdlib/observable/0/observable.rbs +217 -0
- data/stdlib/open-uri/0/manifest.yaml +4 -0
- data/stdlib/open-uri/0/open-uri.rbs +393 -0
- data/stdlib/open3/0/open3.rbs +147 -0
- data/stdlib/openssl/0/manifest.yaml +1 -0
- data/stdlib/openssl/0/openssl.rbs +681 -316
- data/stdlib/optparse/0/optparse.rbs +100 -65
- data/stdlib/pathname/0/pathname.rbs +24 -15
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +300 -0
- data/stdlib/prettyprint/0/prettyprint.rbs +2 -6
- data/stdlib/pstore/0/pstore.rbs +370 -156
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +402 -0
- data/stdlib/{yaml → psych}/0/store.rbs +2 -2
- data/stdlib/pty/0/pty.rbs +63 -11
- data/stdlib/rdoc/0/code_object.rbs +51 -0
- data/stdlib/rdoc/0/comment.rbs +59 -0
- data/stdlib/rdoc/0/context.rbs +153 -0
- data/stdlib/rdoc/0/markup.rbs +117 -0
- data/stdlib/rdoc/0/parser.rbs +56 -0
- data/stdlib/rdoc/0/rdoc.rbs +13 -380
- data/stdlib/rdoc/0/ri.rbs +17 -0
- data/stdlib/rdoc/0/store.rbs +48 -0
- data/stdlib/rdoc/0/top_level.rbs +97 -0
- data/stdlib/resolv/0/resolv.rbs +16 -79
- data/stdlib/ripper/0/ripper.rbs +1648 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -3
- data/stdlib/socket/0/addrinfo.rbs +13 -18
- data/stdlib/socket/0/basic_socket.rbs +5 -10
- data/stdlib/socket/0/ip_socket.rbs +0 -2
- data/stdlib/socket/0/socket.rbs +77 -46
- data/stdlib/socket/0/tcp_server.rbs +0 -5
- data/stdlib/socket/0/tcp_socket.rbs +36 -3
- data/stdlib/socket/0/udp_socket.rbs +4 -5
- data/stdlib/socket/0/unix_server.rbs +0 -5
- data/stdlib/socket/0/unix_socket.rbs +2 -4
- data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +188 -107
- data/stdlib/strscan/0/string_scanner.rbs +1269 -425
- data/stdlib/tempfile/0/tempfile.rbs +224 -61
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +17 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +271 -144
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +26 -22
- data/stdlib/uri/0/http.rbs +4 -4
- data/stdlib/uri/0/ldap.rbs +1 -1
- data/stdlib/uri/0/mailto.rbs +84 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/yaml/0/manifest.yaml +1 -2
- data/stdlib/yaml/0/yaml.rbs +1 -199
- data/stdlib/zlib/0/buf_error.rbs +10 -0
- data/stdlib/zlib/0/data_error.rbs +10 -0
- data/stdlib/zlib/0/deflate.rbs +210 -0
- data/stdlib/zlib/0/error.rbs +20 -0
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
- data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
- data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
- data/stdlib/zlib/0/gzip_file.rbs +156 -0
- data/stdlib/zlib/0/gzip_reader.rbs +293 -0
- data/stdlib/zlib/0/gzip_writer.rbs +166 -0
- data/stdlib/zlib/0/inflate.rbs +180 -0
- data/stdlib/zlib/0/mem_error.rbs +10 -0
- data/stdlib/zlib/0/need_dict.rbs +13 -0
- data/stdlib/zlib/0/stream_end.rbs +11 -0
- data/stdlib/zlib/0/stream_error.rbs +11 -0
- data/stdlib/zlib/0/version_error.rbs +11 -0
- data/stdlib/zlib/0/zlib.rbs +1 -3
- data/stdlib/zlib/0/zstream.rbs +200 -0
- data/templates/include/rbs/constants.h.erb +20 -0
- data/templates/include/rbs/ruby_objs.h.erb +10 -0
- data/templates/src/constants.c.erb +36 -0
- data/templates/src/ruby_objs.c.erb +27 -0
- data/templates/template.rb +122 -0
- metadata +136 -36
- data/Gemfile +0 -33
- data/Gemfile.lock +0 -118
- data/core/deprecated.rbs +0 -9
- data/ext/rbs_extension/constants.c +0 -135
- data/ext/rbs_extension/ruby_objs.c +0 -525
- data/ext/rbs_extension/ruby_objs.h +0 -43
- data/lib/rbs/constant_table.rb +0 -167
- data/lib/rbs/parser_compat/lexer_error.rb +0 -6
- data/lib/rbs/parser_compat/located_value.rb +0 -7
- data/lib/rbs/parser_compat/semantics_error.rb +0 -6
- data/lib/rbs/parser_compat/syntax_error.rb +0 -6
- data/lib/rbs/test/spy.rb +0 -6
- data/lib/rbs/type_name_resolver.rb +0 -67
- data/sig/constant_table.rbs +0 -30
- data/sig/shims/abstract_syntax_tree.rbs +0 -25
- data/sig/shims/pp.rbs +0 -3
- data/sig/shims/ripper.rbs +0 -8
- data/sig/shims.rbs +0 -69
- data/sig/type_name_resolver.rbs +0 -26
- data/stdlib/minitest/0/manifest.yaml +0 -2
- data/stdlib/prime/0/integer-extension.rbs +0 -41
- data/stdlib/prime/0/manifest.yaml +0 -2
- data/stdlib/prime/0/prime.rbs +0 -372
data/core/module.rbs
CHANGED
@@ -85,13 +85,41 @@ class Module < Object
|
|
85
85
|
#
|
86
86
|
def self.used_modules: () -> ::Array[Module]
|
87
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
|
+
# *produces:*
|
110
|
+
#
|
111
|
+
# [#<refinement:Object@B>, #<refinement:Object@A>]
|
112
|
+
#
|
113
|
+
def self.used_refinements: () -> Array[Refinement]
|
114
|
+
|
88
115
|
# <!--
|
89
116
|
# rdoc-file=object.c
|
90
117
|
# - mod < other -> true, false, or nil
|
91
118
|
# -->
|
92
|
-
# Returns true if *mod* is a subclass of *other*. Returns `
|
93
|
-
#
|
94
|
-
#
|
119
|
+
# Returns true if *mod* is a subclass of *other*. Returns `false` if *mod* is
|
120
|
+
# the same as *other* or *mod* is an ancestor of *other*. Returns `nil` if
|
121
|
+
# there's no relationship between the two. (Think of the relationship in terms
|
122
|
+
# of the class definition: "class A < B" implies "A < B".)
|
95
123
|
#
|
96
124
|
def <: (Module other) -> bool?
|
97
125
|
|
@@ -169,9 +197,10 @@ class Module < Object
|
|
169
197
|
# rdoc-file=object.c
|
170
198
|
# - mod > other -> true, false, or nil
|
171
199
|
# -->
|
172
|
-
# Returns true if *mod* is an ancestor of *other*. Returns `
|
173
|
-
#
|
174
|
-
#
|
200
|
+
# Returns true if *mod* is an ancestor of *other*. Returns `false` if *mod* is
|
201
|
+
# the same as *other* or *mod* is a descendant of *other*. Returns `nil` if
|
202
|
+
# there's no relationship between the two. (Think of the relationship in terms
|
203
|
+
# of the class definition: "class A < B" implies "B > A".)
|
175
204
|
#
|
176
205
|
def >: (Module other) -> bool?
|
177
206
|
|
@@ -206,7 +235,7 @@ class Module < Object
|
|
206
235
|
#
|
207
236
|
# Exiting with code 99
|
208
237
|
#
|
209
|
-
def alias_method: (
|
238
|
+
def alias_method: (interned new_name, interned old_name) -> ::Symbol
|
210
239
|
|
211
240
|
# <!--
|
212
241
|
# rdoc-file=object.c
|
@@ -255,7 +284,7 @@ class Module < Object
|
|
255
284
|
# end
|
256
285
|
# Mod.instance_methods.sort #=> [:one, :one=, :two, :two=]
|
257
286
|
#
|
258
|
-
def attr_accessor: (*
|
287
|
+
def attr_accessor: (*interned arg0) -> Array[Symbol]
|
259
288
|
|
260
289
|
# <!--
|
261
290
|
# rdoc-file=object.c
|
@@ -269,7 +298,7 @@ class Module < Object
|
|
269
298
|
# in turn. String arguments are converted to symbols. Returns an array of
|
270
299
|
# defined method names as symbols.
|
271
300
|
#
|
272
|
-
def attr_reader: (*
|
301
|
+
def attr_reader: (*interned arg0) -> Array[Symbol]
|
273
302
|
|
274
303
|
# <!--
|
275
304
|
# rdoc-file=object.c
|
@@ -280,14 +309,14 @@ class Module < Object
|
|
280
309
|
# *symbol*`.id2name`. String arguments are converted to symbols. Returns an
|
281
310
|
# array of defined method names as symbols.
|
282
311
|
#
|
283
|
-
def attr_writer: (*
|
312
|
+
def attr_writer: (*interned arg0) -> Array[Symbol]
|
284
313
|
|
285
314
|
# <!--
|
286
315
|
# rdoc-file=load.c
|
287
|
-
# - mod.autoload(
|
316
|
+
# - mod.autoload(const, filename) -> nil
|
288
317
|
# -->
|
289
318
|
# Registers *filename* to be loaded (using Kernel::require) the first time that
|
290
|
-
# *
|
319
|
+
# *const* (which may be a String or a symbol) is accessed in the namespace of
|
291
320
|
# *mod*.
|
292
321
|
#
|
293
322
|
# module A
|
@@ -295,7 +324,11 @@ class Module < Object
|
|
295
324
|
# A.autoload(:B, "b")
|
296
325
|
# A::B.doit # autoloads "b"
|
297
326
|
#
|
298
|
-
|
327
|
+
# If *const* in *mod* is defined as autoload, the file name to be loaded is
|
328
|
+
# replaced with *filename*. If *const* is defined but not as autoload, does
|
329
|
+
# nothing.
|
330
|
+
#
|
331
|
+
def autoload: (interned _module, String filename) -> NilClass
|
299
332
|
|
300
333
|
# <!--
|
301
334
|
# rdoc-file=load.c
|
@@ -321,7 +354,7 @@ class Module < Object
|
|
321
354
|
# B.autoload?(:CONST) #=> "const.rb", found in A (ancestor)
|
322
355
|
# B.autoload?(:CONST, false) #=> nil, not found in B itself
|
323
356
|
#
|
324
|
-
def autoload?: (
|
357
|
+
def autoload?: (interned name, ?boolish inherit) -> String?
|
325
358
|
|
326
359
|
# <!-- rdoc-file=vm_eval.c -->
|
327
360
|
# Evaluates the string or block in the context of *mod*, except that when a
|
@@ -344,7 +377,7 @@ class Module < Object
|
|
344
377
|
# or method `code' for Thing:Class
|
345
378
|
#
|
346
379
|
def class_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
|
347
|
-
| [U] () { (self m) -> U } -> U
|
380
|
+
| [U] () { (self m) [self: self] -> U } -> U
|
348
381
|
|
349
382
|
# <!-- rdoc-file=vm_eval.c -->
|
350
383
|
# Evaluates the given block in the context of the class/module. The method
|
@@ -363,7 +396,7 @@ class Module < Object
|
|
363
396
|
#
|
364
397
|
# Hello there!
|
365
398
|
#
|
366
|
-
def class_exec: [U] (*untyped
|
399
|
+
def class_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
|
367
400
|
|
368
401
|
# <!--
|
369
402
|
# rdoc-file=object.c
|
@@ -379,7 +412,7 @@ class Module < Object
|
|
379
412
|
# Fred.class_variable_defined?(:@@foo) #=> true
|
380
413
|
# Fred.class_variable_defined?(:@@bar) #=> false
|
381
414
|
#
|
382
|
-
def class_variable_defined?: (
|
415
|
+
def class_variable_defined?: (interned arg0) -> bool
|
383
416
|
|
384
417
|
# <!--
|
385
418
|
# rdoc-file=object.c
|
@@ -395,7 +428,7 @@ class Module < Object
|
|
395
428
|
# end
|
396
429
|
# Fred.class_variable_get(:@@foo) #=> 99
|
397
430
|
#
|
398
|
-
def class_variable_get: (
|
431
|
+
def class_variable_get: (interned arg0) -> untyped
|
399
432
|
|
400
433
|
# <!--
|
401
434
|
# rdoc-file=object.c
|
@@ -414,7 +447,7 @@ class Module < Object
|
|
414
447
|
# Fred.class_variable_set(:@@foo, 101) #=> 101
|
415
448
|
# Fred.new.foo #=> 101
|
416
449
|
#
|
417
|
-
def class_variable_set: (
|
450
|
+
def class_variable_set: (interned arg0, untyped arg1) -> untyped
|
418
451
|
|
419
452
|
# <!--
|
420
453
|
# rdoc-file=object.c
|
@@ -436,6 +469,26 @@ class Module < Object
|
|
436
469
|
#
|
437
470
|
def class_variables: (?boolish inherit) -> ::Array[Symbol]
|
438
471
|
|
472
|
+
# <!--
|
473
|
+
# rdoc-file=object.c
|
474
|
+
# - const_added(const_name)
|
475
|
+
# -->
|
476
|
+
# Invoked as a callback whenever a constant is assigned on the receiver
|
477
|
+
#
|
478
|
+
# module Chatty
|
479
|
+
# def self.const_added(const_name)
|
480
|
+
# super
|
481
|
+
# puts "Added #{const_name.inspect}"
|
482
|
+
# end
|
483
|
+
# FOO = 1
|
484
|
+
# end
|
485
|
+
#
|
486
|
+
# *produces:*
|
487
|
+
#
|
488
|
+
# Added :FOO
|
489
|
+
#
|
490
|
+
def const_added: (Symbol) -> void
|
491
|
+
|
439
492
|
# <!--
|
440
493
|
# rdoc-file=object.c
|
441
494
|
# - mod.const_defined?(sym, inherit=true) -> true or false
|
@@ -474,7 +527,7 @@ class Module < Object
|
|
474
527
|
#
|
475
528
|
# Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
|
476
529
|
#
|
477
|
-
def const_defined?: (
|
530
|
+
def const_defined?: (interned name, ?boolish inherit) -> bool
|
478
531
|
|
479
532
|
# <!--
|
480
533
|
# rdoc-file=object.c
|
@@ -513,7 +566,7 @@ class Module < Object
|
|
513
566
|
#
|
514
567
|
# Object.const_get 'foobar' #=> NameError: wrong constant name foobar
|
515
568
|
#
|
516
|
-
def const_get: (
|
569
|
+
def const_get: (interned name, ?boolish inherit) -> untyped
|
517
570
|
|
518
571
|
# <!--
|
519
572
|
# rdoc-file=object.c
|
@@ -521,7 +574,7 @@ class Module < Object
|
|
521
574
|
# -->
|
522
575
|
# Invoked when a reference is made to an undefined constant in *mod*. It is
|
523
576
|
# passed a symbol for the undefined constant, and returns a value to be used for
|
524
|
-
# that constant.
|
577
|
+
# that constant. For example, consider:
|
525
578
|
#
|
526
579
|
# def Foo.const_missing(name)
|
527
580
|
# name # return the constant name as Symbol
|
@@ -529,22 +582,27 @@ class Module < Object
|
|
529
582
|
#
|
530
583
|
# Foo::UNDEFINED_CONST #=> :UNDEFINED_CONST: symbol returned
|
531
584
|
#
|
532
|
-
#
|
533
|
-
#
|
534
|
-
#
|
535
|
-
#
|
536
|
-
#
|
585
|
+
# As the example above shows, `const_missing` is not required to create the
|
586
|
+
# missing constant in *mod*, though that is often a side-effect. The caller gets
|
587
|
+
# its return value when triggered. If the constant is also defined, further
|
588
|
+
# lookups won't hit `const_missing` and will return the value stored in the
|
589
|
+
# constant as usual. Otherwise, `const_missing` will be invoked again.
|
590
|
+
#
|
591
|
+
# In the next example, when a reference is made to an undefined constant,
|
592
|
+
# `const_missing` attempts to load a file whose path is the lowercase version of
|
593
|
+
# the constant name (thus class `Fred` is assumed to be in file `fred.rb`). If
|
594
|
+
# defined as a side-effect of loading the file, the method returns the value
|
595
|
+
# stored in the constant. This implements an autoload feature similar to
|
596
|
+
# Kernel#autoload and Module#autoload, though it differs in important ways.
|
537
597
|
#
|
538
598
|
# def Object.const_missing(name)
|
539
599
|
# @looked_for ||= {}
|
540
600
|
# str_name = name.to_s
|
541
|
-
# raise "
|
601
|
+
# raise "Constant not found: #{name}" if @looked_for[str_name]
|
542
602
|
# @looked_for[str_name] = 1
|
543
603
|
# file = str_name.downcase
|
544
604
|
# require file
|
545
|
-
#
|
546
|
-
# return klass if klass
|
547
|
-
# raise "Class not found: #{name}"
|
605
|
+
# const_get(name, false)
|
548
606
|
# end
|
549
607
|
#
|
550
608
|
def const_missing: (Symbol arg0) -> untyped
|
@@ -565,7 +623,7 @@ class Module < Object
|
|
565
623
|
#
|
566
624
|
# Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
|
567
625
|
#
|
568
|
-
def const_set: (
|
626
|
+
def const_set: (interned arg0, untyped arg1) -> untyped
|
569
627
|
|
570
628
|
# <!--
|
571
629
|
# rdoc-file=object.c
|
@@ -615,7 +673,7 @@ class Module < Object
|
|
615
673
|
# p Object.const_source_location('A::C1') # => ["test.rb", 2] -- nesting is supported
|
616
674
|
# p Object.const_source_location('String') # => [] -- constant is defined in C code
|
617
675
|
#
|
618
|
-
def const_source_location: (
|
676
|
+
def const_source_location: (interned name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
|
619
677
|
|
620
678
|
# <!--
|
621
679
|
# rdoc-file=object.c
|
@@ -673,8 +731,8 @@ class Module < Object
|
|
673
731
|
# I'm Dino!
|
674
732
|
# #<B:0x401b39e8>
|
675
733
|
#
|
676
|
-
def define_method: (
|
677
|
-
| (
|
734
|
+
def define_method: (interned symbol, ^() [self: instance] -> untyped | Method | UnboundMethod method) -> Symbol
|
735
|
+
| (interned symbol) { () [self: instance] -> untyped } -> Symbol
|
678
736
|
|
679
737
|
# <!--
|
680
738
|
# rdoc-file=object.c
|
@@ -693,7 +751,7 @@ class Module < Object
|
|
693
751
|
# HTTP::NOT_FOUND
|
694
752
|
# # warning: constant HTTP::NOT_FOUND is deprecated
|
695
753
|
#
|
696
|
-
def deprecate_constant: (*
|
754
|
+
def deprecate_constant: (*interned) -> self
|
697
755
|
|
698
756
|
def eql?: (untyped other) -> bool
|
699
757
|
|
@@ -761,7 +819,7 @@ class Module < Object
|
|
761
819
|
# -->
|
762
820
|
# Invokes Module.append_features on each parameter in reverse order.
|
763
821
|
#
|
764
|
-
def include: (*Module arg0) -> self
|
822
|
+
def include: (Module, *Module arg0) -> self
|
765
823
|
|
766
824
|
# <!--
|
767
825
|
# rdoc-file=object.c
|
@@ -851,7 +909,7 @@ class Module < Object
|
|
851
909
|
# Assign the module to a constant (name starting uppercase) if you want to treat
|
852
910
|
# it like a regular module.
|
853
911
|
#
|
854
|
-
def initialize: () ->
|
912
|
+
def initialize: () -> void
|
855
913
|
| () { (Module arg0) -> untyped } -> void
|
856
914
|
|
857
915
|
# <!--
|
@@ -883,7 +941,7 @@ class Module < Object
|
|
883
941
|
#
|
884
942
|
# Hello there, Dave!
|
885
943
|
#
|
886
|
-
def instance_method: (
|
944
|
+
def instance_method: (interned arg0) -> UnboundMethod
|
887
945
|
|
888
946
|
# <!--
|
889
947
|
# rdoc-file=object.c
|
@@ -911,6 +969,15 @@ class Module < Object
|
|
911
969
|
# C.instance_methods(false) #=> [:method3]
|
912
970
|
# C.instance_methods.include?(:method2) #=> true
|
913
971
|
#
|
972
|
+
# Note that method visibility changes in the current class, as well as aliases,
|
973
|
+
# are considered as methods of the current class by this method:
|
974
|
+
#
|
975
|
+
# class C < B
|
976
|
+
# alias method4 method2
|
977
|
+
# protected :method2
|
978
|
+
# end
|
979
|
+
# C.instance_methods(false).sort #=> [:method2, :method3, :method4]
|
980
|
+
#
|
914
981
|
def instance_methods: (?boolish include_super) -> ::Array[Symbol]
|
915
982
|
|
916
983
|
# <!--
|
@@ -967,7 +1034,7 @@ class Module < Object
|
|
967
1034
|
# C.method_defined? "method4" #=> false
|
968
1035
|
# C.method_defined? "private_method2" #=> false
|
969
1036
|
#
|
970
|
-
def method_defined?: (
|
1037
|
+
def method_defined?: (interned name, ?boolish inherit) -> bool
|
971
1038
|
|
972
1039
|
# <!--
|
973
1040
|
# rdoc-file=object.c
|
@@ -1021,7 +1088,7 @@ class Module < Object
|
|
1021
1088
|
# or method `code' for Thing:Class
|
1022
1089
|
#
|
1023
1090
|
def module_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
|
1024
|
-
| [U] () { (self m) -> U } -> U
|
1091
|
+
| [U] () { (self m) [self: self] -> U } -> U
|
1025
1092
|
|
1026
1093
|
# <!--
|
1027
1094
|
# rdoc-file=vm_eval.c
|
@@ -1044,7 +1111,7 @@ class Module < Object
|
|
1044
1111
|
#
|
1045
1112
|
# Hello there!
|
1046
1113
|
#
|
1047
|
-
def module_exec: [U] (*untyped
|
1114
|
+
def module_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
|
1048
1115
|
|
1049
1116
|
# <!--
|
1050
1117
|
# rdoc-file=vm_method.c
|
@@ -1085,13 +1152,17 @@ class Module < Object
|
|
1085
1152
|
# Mod.one #=> "This is one"
|
1086
1153
|
# c.call_one #=> "This is the new one"
|
1087
1154
|
#
|
1088
|
-
def module_function: (
|
1155
|
+
def module_function: () -> nil
|
1156
|
+
| (Symbol method_name) -> Symbol
|
1157
|
+
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
1158
|
+
| (string method_name) -> string
|
1159
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
1089
1160
|
|
1090
1161
|
# <!--
|
1091
1162
|
# rdoc-file=object.c
|
1092
|
-
# - mod.name -> string
|
1163
|
+
# - mod.name -> string or nil
|
1093
1164
|
# -->
|
1094
|
-
# Returns the name of the module *mod*. Returns nil for anonymous modules.
|
1165
|
+
# Returns the name of the module *mod*. Returns `nil` for anonymous modules.
|
1095
1166
|
#
|
1096
1167
|
def name: () -> String?
|
1097
1168
|
|
@@ -1101,7 +1172,7 @@ class Module < Object
|
|
1101
1172
|
# -->
|
1102
1173
|
# Invokes Module.prepend_features on each parameter in reverse order.
|
1103
1174
|
#
|
1104
|
-
def prepend: (*Module arg0) -> self
|
1175
|
+
def prepend: (Module, *Module arg0) -> self
|
1105
1176
|
|
1106
1177
|
# <!--
|
1107
1178
|
# rdoc-file=eval.c
|
@@ -1162,7 +1233,8 @@ class Module < Object
|
|
1162
1233
|
| (Symbol method_name) -> Symbol
|
1163
1234
|
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
1164
1235
|
| (string method_name) -> string
|
1165
|
-
| (
|
1236
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
1237
|
+
| (Array[interned]) -> Array[interned]
|
1166
1238
|
|
1167
1239
|
# <!--
|
1168
1240
|
# rdoc-file=vm_method.c
|
@@ -1184,7 +1256,8 @@ class Module < Object
|
|
1184
1256
|
# end
|
1185
1257
|
# end
|
1186
1258
|
#
|
1187
|
-
def private_class_method: (*
|
1259
|
+
def private_class_method: (*interned arg0) -> self
|
1260
|
+
| (Array[interned] arg0) -> self
|
1188
1261
|
|
1189
1262
|
# <!--
|
1190
1263
|
# rdoc-file=object.c
|
@@ -1192,7 +1265,7 @@ class Module < Object
|
|
1192
1265
|
# -->
|
1193
1266
|
# Makes a list of existing constants private.
|
1194
1267
|
#
|
1195
|
-
def private_constant: (*
|
1268
|
+
def private_constant: (*interned arg0) -> self
|
1196
1269
|
|
1197
1270
|
# <!--
|
1198
1271
|
# rdoc-file=object.c
|
@@ -1239,7 +1312,7 @@ class Module < Object
|
|
1239
1312
|
# C.private_method_defined? "method2", false #=> false
|
1240
1313
|
# C.method_defined? "method2" #=> false
|
1241
1314
|
#
|
1242
|
-
def private_method_defined?: (
|
1315
|
+
def private_method_defined?: (interned name, ?boolish inherit) -> bool
|
1243
1316
|
|
1244
1317
|
# <!--
|
1245
1318
|
# rdoc-file=vm_method.c
|
@@ -1264,7 +1337,12 @@ class Module < Object
|
|
1264
1337
|
#
|
1265
1338
|
# To show a private method on RDoc, use `:doc:` instead of this.
|
1266
1339
|
#
|
1267
|
-
def protected: (
|
1340
|
+
def protected: () -> nil
|
1341
|
+
| (Symbol method_name) -> Symbol
|
1342
|
+
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
1343
|
+
| (string method_name) -> string
|
1344
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
1345
|
+
| (Array[interned]) -> Array[interned]
|
1268
1346
|
|
1269
1347
|
# <!--
|
1270
1348
|
# rdoc-file=object.c
|
@@ -1303,7 +1381,7 @@ class Module < Object
|
|
1303
1381
|
# C.protected_method_defined? "method2", false #=> false
|
1304
1382
|
# C.method_defined? "method2" #=> true
|
1305
1383
|
#
|
1306
|
-
def protected_method_defined?: (
|
1384
|
+
def protected_method_defined?: (interned name, ?boolish inherit) -> bool
|
1307
1385
|
|
1308
1386
|
# <!--
|
1309
1387
|
# rdoc-file=vm_method.c
|
@@ -1323,7 +1401,8 @@ class Module < Object
|
|
1323
1401
|
| (Symbol method_name) -> Symbol
|
1324
1402
|
| (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
|
1325
1403
|
| (string method_name) -> string
|
1326
|
-
| (
|
1404
|
+
| (interned, interned, *interned method_name) -> Array[interned]
|
1405
|
+
| (Array[interned]) -> Array[interned]
|
1327
1406
|
|
1328
1407
|
# <!--
|
1329
1408
|
# rdoc-file=vm_method.c
|
@@ -1336,7 +1415,8 @@ class Module < Object
|
|
1336
1415
|
# String arguments are converted to symbols. An Array of Symbols and/or Strings
|
1337
1416
|
# is also accepted.
|
1338
1417
|
#
|
1339
|
-
def public_class_method: (*
|
1418
|
+
def public_class_method: (*interned arg0) -> self
|
1419
|
+
| (Array[interned] arg0) -> self
|
1340
1420
|
|
1341
1421
|
# <!--
|
1342
1422
|
# rdoc-file=object.c
|
@@ -1344,7 +1424,7 @@ class Module < Object
|
|
1344
1424
|
# -->
|
1345
1425
|
# Makes a list of existing constants public.
|
1346
1426
|
#
|
1347
|
-
def public_constant: (*
|
1427
|
+
def public_constant: (*interned arg0) -> self
|
1348
1428
|
|
1349
1429
|
# <!--
|
1350
1430
|
# rdoc-file=proc.c
|
@@ -1352,7 +1432,7 @@ class Module < Object
|
|
1352
1432
|
# -->
|
1353
1433
|
# Similar to *instance_method*, searches public method only.
|
1354
1434
|
#
|
1355
|
-
def public_instance_method: (
|
1435
|
+
def public_instance_method: (interned arg0) -> UnboundMethod
|
1356
1436
|
|
1357
1437
|
# <!--
|
1358
1438
|
# rdoc-file=object.c
|
@@ -1391,7 +1471,7 @@ class Module < Object
|
|
1391
1471
|
# C.public_method_defined? "method2" #=> false
|
1392
1472
|
# C.method_defined? "method2" #=> true
|
1393
1473
|
#
|
1394
|
-
def public_method_defined?: (
|
1474
|
+
def public_method_defined?: (interned name, ?boolish inherit) -> bool
|
1395
1475
|
|
1396
1476
|
# <!--
|
1397
1477
|
# rdoc-file=eval.c
|
@@ -1401,7 +1481,29 @@ class Module < Object
|
|
1401
1481
|
#
|
1402
1482
|
# Returns a module, where refined methods are defined.
|
1403
1483
|
#
|
1404
|
-
def refine: (Module mod) { () -> void } -> Refinement
|
1484
|
+
def refine: (Module mod) { () [self: Refinement] -> void } -> Refinement
|
1485
|
+
|
1486
|
+
# <!--
|
1487
|
+
# rdoc-file=eval.c
|
1488
|
+
# - refinements -> array
|
1489
|
+
# -->
|
1490
|
+
# Returns an array of `Refinement` defined within the receiver.
|
1491
|
+
#
|
1492
|
+
# module A
|
1493
|
+
# refine Integer do
|
1494
|
+
# end
|
1495
|
+
#
|
1496
|
+
# refine String do
|
1497
|
+
# end
|
1498
|
+
# end
|
1499
|
+
#
|
1500
|
+
# p A.refinements
|
1501
|
+
#
|
1502
|
+
# *produces:*
|
1503
|
+
#
|
1504
|
+
# [#<refinement:Integer@A>, #<refinement:String@A>]
|
1505
|
+
#
|
1506
|
+
def refinements: () -> Array[Refinement]
|
1405
1507
|
|
1406
1508
|
# <!--
|
1407
1509
|
# rdoc-file=object.c
|
@@ -1421,7 +1523,7 @@ class Module < Object
|
|
1421
1523
|
# 99
|
1422
1524
|
# nil
|
1423
1525
|
#
|
1424
|
-
def remove_class_variable: (
|
1526
|
+
def remove_class_variable: (interned arg0) -> untyped
|
1425
1527
|
|
1426
1528
|
# <!--
|
1427
1529
|
# rdoc-file=object.c
|
@@ -1431,7 +1533,7 @@ class Module < Object
|
|
1431
1533
|
# previous value. If that constant referred to a module, this will not change
|
1432
1534
|
# that module's name and can lead to confusion.
|
1433
1535
|
#
|
1434
|
-
def remove_const: (
|
1536
|
+
def remove_const: (interned arg0) -> untyped
|
1435
1537
|
|
1436
1538
|
# <!--
|
1437
1539
|
# rdoc-file=vm_method.c
|
@@ -1441,7 +1543,56 @@ class Module < Object
|
|
1441
1543
|
# Removes the method identified by *symbol* from the current class. For an
|
1442
1544
|
# example, see Module#undef_method. String arguments are converted to symbols.
|
1443
1545
|
#
|
1444
|
-
def remove_method: (*
|
1546
|
+
def remove_method: (*interned arg0) -> self
|
1547
|
+
|
1548
|
+
# <!--
|
1549
|
+
# rdoc-file=object.c
|
1550
|
+
# - mod.set_temporary_name(string) -> self
|
1551
|
+
# - mod.set_temporary_name(nil) -> self
|
1552
|
+
# -->
|
1553
|
+
# Sets the temporary name of the module. This name is reflected in introspection
|
1554
|
+
# of the module and the values that are related to it, such as instances,
|
1555
|
+
# constants, and methods.
|
1556
|
+
#
|
1557
|
+
# The name should be `nil` or a non-empty string that is not a valid constant
|
1558
|
+
# path (to avoid confusing between permanent and temporary names).
|
1559
|
+
#
|
1560
|
+
# The method can be useful to distinguish dynamically generated classes and
|
1561
|
+
# modules without assigning them to constants.
|
1562
|
+
#
|
1563
|
+
# If the module is given a permanent name by assigning it to a constant, the
|
1564
|
+
# temporary name is discarded. A temporary name can't be assigned to modules
|
1565
|
+
# that have a permanent name.
|
1566
|
+
#
|
1567
|
+
# If the given name is `nil`, the module becomes anonymous again.
|
1568
|
+
#
|
1569
|
+
# Example:
|
1570
|
+
#
|
1571
|
+
# m = Module.new # => #<Module:0x0000000102c68f38>
|
1572
|
+
# m.name #=> nil
|
1573
|
+
#
|
1574
|
+
# m.set_temporary_name("fake_name") # => fake_name
|
1575
|
+
# m.name #=> "fake_name"
|
1576
|
+
#
|
1577
|
+
# m.set_temporary_name(nil) # => #<Module:0x0000000102c68f38>
|
1578
|
+
# m.name #=> nil
|
1579
|
+
#
|
1580
|
+
# c = Class.new
|
1581
|
+
# c.set_temporary_name("MyClass(with description)")
|
1582
|
+
#
|
1583
|
+
# c.new # => #<MyClass(with description):0x0....>
|
1584
|
+
#
|
1585
|
+
# c::M = m
|
1586
|
+
# c::M.name #=> "MyClass(with description)::M"
|
1587
|
+
#
|
1588
|
+
# # Assigning to a constant replaces the name with a permanent one
|
1589
|
+
# C = c
|
1590
|
+
#
|
1591
|
+
# C.name #=> "C"
|
1592
|
+
# C::M.name #=> "C::M"
|
1593
|
+
# c.new # => #<C:0x0....>
|
1594
|
+
#
|
1595
|
+
def set_temporary_name: (string?) -> self
|
1445
1596
|
|
1446
1597
|
# <!--
|
1447
1598
|
# rdoc-file=object.c
|
@@ -1505,9 +1656,18 @@ class Module < Object
|
|
1505
1656
|
#
|
1506
1657
|
# In child
|
1507
1658
|
# In parent
|
1508
|
-
# prog.rb:23: undefined method
|
1659
|
+
# prog.rb:23: undefined method 'hello' for #<Child:0x401b3bb4> (NoMethodError)
|
1660
|
+
#
|
1661
|
+
def undef_method: (*interned arg0) -> self
|
1662
|
+
|
1663
|
+
# <!--
|
1664
|
+
# rdoc-file=object.c
|
1665
|
+
# - mod.undefined_instance_methods -> array
|
1666
|
+
# -->
|
1667
|
+
# Returns a list of the undefined instance methods defined in *mod*. The
|
1668
|
+
# undefined methods of any ancestors are not included.
|
1509
1669
|
#
|
1510
|
-
def
|
1670
|
+
def undefined_instance_methods: () -> Array[Symbol]
|
1511
1671
|
|
1512
1672
|
# <!--
|
1513
1673
|
# rdoc-file=eval.c
|
@@ -1536,5 +1696,9 @@ class Module < Object
|
|
1536
1696
|
# `attr_reader(name)` but deprecated. Returns an array of defined method names
|
1537
1697
|
# as symbols.
|
1538
1698
|
#
|
1539
|
-
def attr: (*
|
1699
|
+
def attr: (*interned arg0) -> Array[Symbol]
|
1700
|
+
|
1701
|
+
# A previous incarnation of `interned` for backward-compatibility (see #1499)
|
1702
|
+
%a{steep:deprecated}
|
1703
|
+
type id = interned
|
1540
1704
|
end
|