rbs-relaxed 3.9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +22 -0
- data/.github/workflows/comments.yml +35 -0
- data/.github/workflows/dependabot.yml +30 -0
- data/.github/workflows/ruby.yml +82 -0
- data/.github/workflows/typecheck.yml +38 -0
- data/.github/workflows/windows.yml +43 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +68 -0
- data/BSDL +22 -0
- data/CHANGELOG.md +1868 -0
- data/COPYING +56 -0
- data/README.md +203 -0
- data/Rakefile +417 -0
- data/Steepfile +44 -0
- data/config.yml +313 -0
- data/core/array.rbs +4062 -0
- data/core/basic_object.rbs +375 -0
- data/core/binding.rbs +150 -0
- data/core/builtin.rbs +277 -0
- data/core/class.rbs +220 -0
- data/core/comparable.rbs +171 -0
- data/core/complex.rbs +786 -0
- data/core/constants.rbs +96 -0
- data/core/data.rbs +415 -0
- data/core/dir.rbs +981 -0
- data/core/encoding.rbs +1371 -0
- data/core/enumerable.rbs +2405 -0
- data/core/enumerator/product.rbs +92 -0
- data/core/enumerator.rbs +630 -0
- data/core/env.rbs +6 -0
- data/core/errno.rbs +673 -0
- data/core/errors.rbs +760 -0
- data/core/exception.rbs +485 -0
- data/core/false_class.rbs +82 -0
- data/core/fiber.rbs +550 -0
- data/core/fiber_error.rbs +11 -0
- data/core/file.rbs +2936 -0
- data/core/file_test.rbs +331 -0
- data/core/float.rbs +1151 -0
- data/core/gc.rbs +644 -0
- data/core/global_variables.rbs +184 -0
- data/core/hash.rbs +1861 -0
- data/core/integer.rbs +1413 -0
- data/core/io/buffer.rbs +984 -0
- data/core/io/wait.rbs +70 -0
- data/core/io.rbs +3406 -0
- data/core/kernel.rbs +3096 -0
- data/core/marshal.rbs +207 -0
- data/core/match_data.rbs +635 -0
- data/core/math.rbs +729 -0
- data/core/method.rbs +386 -0
- data/core/module.rbs +1704 -0
- data/core/nil_class.rbs +209 -0
- data/core/numeric.rbs +818 -0
- data/core/object.rbs +110 -0
- data/core/object_space/weak_key_map.rbs +166 -0
- data/core/object_space.rbs +190 -0
- data/core/proc.rbs +868 -0
- data/core/process.rbs +2296 -0
- data/core/ractor.rbs +1068 -0
- data/core/random.rbs +237 -0
- data/core/range.rbs +1107 -0
- data/core/rational.rbs +531 -0
- data/core/rb_config.rbs +88 -0
- data/core/rbs/unnamed/argf.rbs +1229 -0
- data/core/rbs/unnamed/env_class.rbs +1209 -0
- data/core/rbs/unnamed/random.rbs +293 -0
- data/core/refinement.rbs +59 -0
- data/core/regexp.rbs +1930 -0
- data/core/ruby_vm.rbs +765 -0
- data/core/rubygems/basic_specification.rbs +6 -0
- data/core/rubygems/config_file.rbs +38 -0
- data/core/rubygems/dependency_installer.rbs +6 -0
- data/core/rubygems/errors.rbs +176 -0
- data/core/rubygems/installer.rbs +15 -0
- data/core/rubygems/path_support.rbs +6 -0
- data/core/rubygems/platform.rbs +7 -0
- data/core/rubygems/request_set.rbs +49 -0
- data/core/rubygems/requirement.rbs +148 -0
- data/core/rubygems/rubygems.rbs +1171 -0
- data/core/rubygems/source_list.rbs +15 -0
- data/core/rubygems/specification.rbs +23 -0
- data/core/rubygems/stream_ui.rbs +5 -0
- data/core/rubygems/uninstaller.rbs +10 -0
- data/core/rubygems/version.rbs +294 -0
- data/core/set.rbs +621 -0
- data/core/signal.rbs +100 -0
- data/core/string.rbs +3583 -0
- data/core/struct.rbs +667 -0
- data/core/symbol.rbs +475 -0
- data/core/thread.rbs +1765 -0
- data/core/thread_group.rbs +79 -0
- data/core/time.rbs +1762 -0
- data/core/trace_point.rbs +477 -0
- data/core/true_class.rbs +98 -0
- data/core/unbound_method.rbs +329 -0
- data/core/warning.rbs +87 -0
- data/docs/CONTRIBUTING.md +106 -0
- data/docs/architecture.md +110 -0
- data/docs/collection.md +192 -0
- data/docs/data_and_struct.md +86 -0
- data/docs/gem.md +57 -0
- data/docs/rbs_by_example.md +309 -0
- data/docs/repo.md +125 -0
- data/docs/sigs.md +167 -0
- data/docs/stdlib.md +147 -0
- data/docs/syntax.md +910 -0
- data/docs/tools.md +17 -0
- data/exe/rbs +7 -0
- data/ext/rbs_extension/extconf.rb +15 -0
- data/ext/rbs_extension/lexer.c +2728 -0
- data/ext/rbs_extension/lexer.h +179 -0
- data/ext/rbs_extension/lexer.re +147 -0
- data/ext/rbs_extension/lexstate.c +175 -0
- data/ext/rbs_extension/location.c +325 -0
- data/ext/rbs_extension/location.h +85 -0
- data/ext/rbs_extension/main.c +33 -0
- data/ext/rbs_extension/parser.c +2973 -0
- data/ext/rbs_extension/parser.h +18 -0
- data/ext/rbs_extension/parserstate.c +397 -0
- data/ext/rbs_extension/parserstate.h +163 -0
- data/ext/rbs_extension/rbs_extension.h +31 -0
- data/ext/rbs_extension/unescape.c +32 -0
- data/goodcheck.yml +91 -0
- data/include/rbs/constants.h +82 -0
- data/include/rbs/ruby_objs.h +72 -0
- data/include/rbs/util/rbs_constant_pool.h +219 -0
- data/include/rbs.h +7 -0
- data/lib/rbs/ancestor_graph.rb +92 -0
- data/lib/rbs/annotate/annotations.rb +199 -0
- data/lib/rbs/annotate/formatter.rb +92 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +400 -0
- data/lib/rbs/annotate/rdoc_source.rb +131 -0
- data/lib/rbs/annotate.rb +8 -0
- data/lib/rbs/ast/annotation.rb +29 -0
- data/lib/rbs/ast/comment.rb +29 -0
- data/lib/rbs/ast/declarations.rb +467 -0
- data/lib/rbs/ast/directives.rb +49 -0
- data/lib/rbs/ast/members.rb +451 -0
- data/lib/rbs/ast/type_param.rb +225 -0
- data/lib/rbs/ast/visitor.rb +137 -0
- data/lib/rbs/buffer.rb +67 -0
- data/lib/rbs/builtin_names.rb +58 -0
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +83 -0
- data/lib/rbs/cli/validate.rb +357 -0
- data/lib/rbs/cli.rb +1223 -0
- data/lib/rbs/collection/cleaner.rb +38 -0
- data/lib/rbs/collection/config/lockfile.rb +92 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +218 -0
- data/lib/rbs/collection/config.rb +81 -0
- data/lib/rbs/collection/installer.rb +32 -0
- data/lib/rbs/collection/sources/base.rb +14 -0
- data/lib/rbs/collection/sources/git.rb +258 -0
- data/lib/rbs/collection/sources/local.rb +81 -0
- data/lib/rbs/collection/sources/rubygems.rb +48 -0
- data/lib/rbs/collection/sources/stdlib.rb +50 -0
- data/lib/rbs/collection/sources.rb +38 -0
- data/lib/rbs/collection.rb +16 -0
- data/lib/rbs/constant.rb +28 -0
- data/lib/rbs/definition.rb +401 -0
- data/lib/rbs/definition_builder/ancestor_builder.rb +620 -0
- data/lib/rbs/definition_builder/method_builder.rb +254 -0
- data/lib/rbs/definition_builder.rb +845 -0
- data/lib/rbs/diff.rb +125 -0
- data/lib/rbs/environment/use_map.rb +77 -0
- data/lib/rbs/environment.rb +829 -0
- data/lib/rbs/environment_loader.rb +173 -0
- data/lib/rbs/environment_walker.rb +155 -0
- data/lib/rbs/errors.rb +645 -0
- data/lib/rbs/factory.rb +18 -0
- data/lib/rbs/file_finder.rb +28 -0
- data/lib/rbs/location_aux.rb +138 -0
- data/lib/rbs/locator.rb +243 -0
- data/lib/rbs/method_type.rb +143 -0
- data/lib/rbs/namespace.rb +125 -0
- data/lib/rbs/parser/lex_result.rb +15 -0
- data/lib/rbs/parser/token.rb +23 -0
- data/lib/rbs/parser_aux.rb +114 -0
- data/lib/rbs/prototype/helpers.rb +140 -0
- data/lib/rbs/prototype/node_usage.rb +99 -0
- data/lib/rbs/prototype/rb.rb +840 -0
- data/lib/rbs/prototype/rbi.rb +641 -0
- 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 +667 -0
- data/lib/rbs/repository.rb +127 -0
- data/lib/rbs/resolver/constant_resolver.rb +219 -0
- data/lib/rbs/resolver/type_name_resolver.rb +91 -0
- data/lib/rbs/sorter.rb +198 -0
- data/lib/rbs/substitution.rb +83 -0
- data/lib/rbs/subtractor.rb +201 -0
- data/lib/rbs/test/errors.rb +80 -0
- data/lib/rbs/test/guaranteed.rb +30 -0
- data/lib/rbs/test/hook.rb +212 -0
- data/lib/rbs/test/observer.rb +19 -0
- data/lib/rbs/test/setup.rb +84 -0
- data/lib/rbs/test/setup_helper.rb +50 -0
- data/lib/rbs/test/tester.rb +167 -0
- data/lib/rbs/test/type_check.rb +435 -0
- data/lib/rbs/test.rb +112 -0
- data/lib/rbs/type_alias_dependency.rb +100 -0
- data/lib/rbs/type_alias_regularity.rb +126 -0
- data/lib/rbs/type_name.rb +109 -0
- data/lib/rbs/types.rb +1596 -0
- data/lib/rbs/unit_test/convertibles.rb +176 -0
- data/lib/rbs/unit_test/spy.rb +138 -0
- data/lib/rbs/unit_test/type_assertions.rb +347 -0
- data/lib/rbs/unit_test/with_aliases.rb +143 -0
- data/lib/rbs/unit_test.rb +6 -0
- data/lib/rbs/validator.rb +186 -0
- data/lib/rbs/variance_calculator.rb +189 -0
- data/lib/rbs/vendorer.rb +71 -0
- data/lib/rbs/version.rb +5 -0
- data/lib/rbs/writer.rb +424 -0
- data/lib/rbs.rb +94 -0
- data/lib/rdoc/discover.rb +20 -0
- data/lib/rdoc_plugin/parser.rb +163 -0
- data/rbs-relaxed.gemspec +48 -0
- data/schema/annotation.json +14 -0
- data/schema/comment.json +26 -0
- data/schema/decls.json +326 -0
- data/schema/function.json +87 -0
- data/schema/location.json +56 -0
- data/schema/members.json +266 -0
- data/schema/methodType.json +50 -0
- data/schema/typeParam.json +36 -0
- data/schema/types.json +317 -0
- data/sig/ancestor_builder.rbs +163 -0
- data/sig/ancestor_graph.rbs +60 -0
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/annotation.rbs +27 -0
- data/sig/buffer.rbs +32 -0
- data/sig/builtin_names.rbs +44 -0
- 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 +87 -0
- data/sig/collection/cleaner.rbs +13 -0
- data/sig/collection/config/lockfile.rbs +74 -0
- data/sig/collection/config/lockfile_generator.rbs +66 -0
- data/sig/collection/config.rbs +46 -0
- data/sig/collection/installer.rbs +17 -0
- data/sig/collection/sources.rbs +214 -0
- data/sig/collection.rbs +4 -0
- data/sig/comment.rbs +26 -0
- data/sig/constant.rbs +21 -0
- data/sig/declarations.rbs +267 -0
- data/sig/definition.rbs +173 -0
- data/sig/definition_builder.rbs +165 -0
- data/sig/diff.rbs +28 -0
- data/sig/directives.rbs +77 -0
- data/sig/environment.rbs +279 -0
- data/sig/environment_loader.rbs +111 -0
- data/sig/environment_walker.rbs +65 -0
- data/sig/errors.rbs +405 -0
- data/sig/factory.rbs +5 -0
- data/sig/file_finder.rbs +28 -0
- data/sig/location.rbs +110 -0
- data/sig/locator.rbs +58 -0
- data/sig/manifest.yaml +7 -0
- data/sig/members.rbs +258 -0
- data/sig/method_builder.rbs +84 -0
- data/sig/method_types.rbs +58 -0
- data/sig/namespace.rbs +146 -0
- data/sig/parser.rbs +100 -0
- data/sig/prototype/helpers.rbs +27 -0
- data/sig/prototype/node_usage.rbs +20 -0
- data/sig/prototype/rb.rbs +96 -0
- data/sig/prototype/rbi.rbs +75 -0
- data/sig/prototype/runtime.rbs +182 -0
- data/sig/rbs.rbs +21 -0
- data/sig/rdoc/rbs.rbs +67 -0
- data/sig/repository.rbs +85 -0
- data/sig/resolver/constant_resolver.rbs +92 -0
- data/sig/resolver/context.rbs +34 -0
- data/sig/resolver/type_name_resolver.rbs +35 -0
- data/sig/shims/bundler.rbs +38 -0
- data/sig/shims/enumerable.rbs +5 -0
- data/sig/shims/rubygems.rbs +19 -0
- data/sig/sorter.rbs +41 -0
- data/sig/substitution.rbs +48 -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 +53 -0
- data/sig/type_alias_regularity.rbs +98 -0
- data/sig/type_param.rbs +110 -0
- data/sig/typename.rbs +79 -0
- data/sig/types.rbs +579 -0
- data/sig/unit_test/convertibles.rbs +154 -0
- data/sig/unit_test/spy.rbs +30 -0
- data/sig/unit_test/type_assertions.rbs +196 -0
- data/sig/unit_test/with_aliases.rbs +136 -0
- data/sig/use_map.rbs +35 -0
- data/sig/util.rbs +9 -0
- data/sig/validator.rbs +63 -0
- data/sig/variance_calculator.rbs +87 -0
- data/sig/vendorer.rbs +51 -0
- data/sig/version.rbs +3 -0
- data/sig/visitor.rbs +47 -0
- data/sig/writer.rbs +127 -0
- data/src/constants.c +153 -0
- data/src/ruby_objs.c +795 -0
- data/src/util/rbs_constant_pool.c +342 -0
- data/stdlib/abbrev/0/abbrev.rbs +66 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +355 -0
- data/stdlib/benchmark/0/benchmark.rbs +452 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +1629 -0
- data/stdlib/bigdecimal-math/0/big_math.rbs +119 -0
- data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
- data/stdlib/cgi/0/core.rbs +1285 -0
- data/stdlib/cgi/0/manifest.yaml +3 -0
- data/stdlib/coverage/0/coverage.rbs +263 -0
- data/stdlib/csv/0/csv.rbs +3776 -0
- data/stdlib/csv/0/manifest.yaml +3 -0
- data/stdlib/date/0/date.rbs +1585 -0
- data/stdlib/date/0/date_time.rbs +616 -0
- data/stdlib/date/0/time.rbs +26 -0
- data/stdlib/dbm/0/dbm.rbs +421 -0
- 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 +343 -0
- data/stdlib/digest/0/digest.rbs +577 -0
- data/stdlib/erb/0/erb.rbs +532 -0
- data/stdlib/etc/0/etc.rbs +865 -0
- data/stdlib/fileutils/0/fileutils.rbs +1734 -0
- data/stdlib/find/0/find.rbs +49 -0
- data/stdlib/forwardable/0/forwardable.rbs +268 -0
- data/stdlib/io-console/0/io-console.rbs +414 -0
- data/stdlib/ipaddr/0/ipaddr.rbs +428 -0
- data/stdlib/json/0/json.rbs +1916 -0
- data/stdlib/kconv/0/kconv.rbs +166 -0
- data/stdlib/logger/0/formatter.rbs +45 -0
- data/stdlib/logger/0/log_device.rbs +100 -0
- data/stdlib/logger/0/logger.rbs +796 -0
- data/stdlib/logger/0/manifest.yaml +2 -0
- data/stdlib/logger/0/period.rbs +17 -0
- data/stdlib/logger/0/severity.rbs +34 -0
- data/stdlib/minitest/0/kernel.rbs +42 -0
- data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
- data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
- data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
- data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
- data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
- data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
- data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
- 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/expectation.rbs +2 -0
- data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
- data/stdlib/minitest/0/minitest/guard.rbs +64 -0
- data/stdlib/minitest/0/minitest/mock.rbs +64 -0
- data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
- data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
- data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
- data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
- data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
- data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
- data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
- data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
- data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
- data/stdlib/minitest/0/minitest/result.rbs +28 -0
- data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
- data/stdlib/minitest/0/minitest/skip.rbs +6 -0
- data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
- data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
- data/stdlib/minitest/0/minitest/spec.rbs +11 -0
- data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
- data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
- data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
- data/stdlib/minitest/0/minitest/test.rbs +69 -0
- data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
- data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
- data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
- data/stdlib/minitest/0/minitest/unit.rbs +4 -0
- data/stdlib/minitest/0/minitest.rbs +115 -0
- data/stdlib/monitor/0/monitor.rbs +363 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
- data/stdlib/net-http/0/manifest.yaml +3 -0
- data/stdlib/net-http/0/net-http.rbs +5552 -0
- 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 +402 -0
- data/stdlib/objspace/0/objspace.rbs +487 -0
- 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 +3 -0
- data/stdlib/openssl/0/openssl.rbs +12113 -0
- data/stdlib/optparse/0/optparse.rbs +1725 -0
- data/stdlib/pathname/0/pathname.rbs +1406 -0
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +300 -0
- data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
- data/stdlib/pstore/0/pstore.rbs +603 -0
- data/stdlib/psych/0/core_ext.rbs +12 -0
- data/stdlib/psych/0/dbm.rbs +237 -0
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +402 -0
- data/stdlib/psych/0/store.rbs +59 -0
- data/stdlib/pty/0/pty.rbs +237 -0
- 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 +391 -0
- 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/manifest.yaml +3 -0
- data/stdlib/resolv/0/resolv.rbs +1830 -0
- data/stdlib/ripper/0/ripper.rbs +1648 -0
- data/stdlib/securerandom/0/securerandom.rbs +62 -0
- data/stdlib/shellwords/0/shellwords.rbs +229 -0
- data/stdlib/singleton/0/singleton.rbs +131 -0
- data/stdlib/socket/0/addrinfo.rbs +666 -0
- data/stdlib/socket/0/basic_socket.rbs +590 -0
- data/stdlib/socket/0/constants.rbs +2295 -0
- data/stdlib/socket/0/ip_socket.rbs +92 -0
- data/stdlib/socket/0/socket.rbs +4157 -0
- data/stdlib/socket/0/socket_error.rbs +5 -0
- data/stdlib/socket/0/tcp_server.rbs +192 -0
- data/stdlib/socket/0/tcp_socket.rbs +79 -0
- data/stdlib/socket/0/udp_socket.rbs +133 -0
- data/stdlib/socket/0/unix_server.rbs +169 -0
- data/stdlib/socket/0/unix_socket.rbs +172 -0
- data/stdlib/stringio/0/stringio.rbs +567 -0
- data/stdlib/strscan/0/string_scanner.rbs +1627 -0
- data/stdlib/tempfile/0/tempfile.rbs +479 -0
- data/stdlib/time/0/time.rbs +432 -0
- data/stdlib/timeout/0/timeout.rbs +81 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
- data/stdlib/tsort/0/cyclic.rbs +5 -0
- data/stdlib/tsort/0/interfaces.rbs +20 -0
- data/stdlib/tsort/0/tsort.rbs +409 -0
- data/stdlib/uri/0/common.rbs +582 -0
- data/stdlib/uri/0/file.rbs +118 -0
- data/stdlib/uri/0/ftp.rbs +13 -0
- data/stdlib/uri/0/generic.rbs +1108 -0
- data/stdlib/uri/0/http.rbs +104 -0
- data/stdlib/uri/0/https.rbs +14 -0
- data/stdlib/uri/0/ldap.rbs +230 -0
- data/stdlib/uri/0/ldaps.rbs +14 -0
- data/stdlib/uri/0/mailto.rbs +92 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
- data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
- data/stdlib/uri/0/ws.rbs +13 -0
- data/stdlib/uri/0/wss.rbs +9 -0
- data/stdlib/yaml/0/manifest.yaml +2 -0
- data/stdlib/yaml/0/yaml.rbs +1 -0
- 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 +449 -0
- data/stdlib/zlib/0/zstream.rbs +200 -0
- metadata +532 -0
@@ -0,0 +1,1406 @@
|
|
1
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
2
|
+
# Pathname represents the name of a file or directory on the filesystem, but not
|
3
|
+
# the file itself.
|
4
|
+
#
|
5
|
+
# The pathname depends on the Operating System: Unix, Windows, etc. This library
|
6
|
+
# works with pathnames of local OS, however non-Unix pathnames are supported
|
7
|
+
# experimentally.
|
8
|
+
#
|
9
|
+
# A Pathname can be relative or absolute. It's not until you try to reference
|
10
|
+
# the file that it even matters whether the file exists or not.
|
11
|
+
#
|
12
|
+
# Pathname is immutable. It has no method for destructive update.
|
13
|
+
#
|
14
|
+
# The goal of this class is to manipulate file path information in a neater way
|
15
|
+
# than standard Ruby provides. The examples below demonstrate the difference.
|
16
|
+
#
|
17
|
+
# **All** functionality from File, FileTest, and some from Dir and FileUtils is
|
18
|
+
# included, in an unsurprising way. It is essentially a facade for all of
|
19
|
+
# these, and more.
|
20
|
+
#
|
21
|
+
# ## Examples
|
22
|
+
#
|
23
|
+
# ### Example 1: Using Pathname
|
24
|
+
#
|
25
|
+
# require 'pathname'
|
26
|
+
# pn = Pathname.new("/usr/bin/ruby")
|
27
|
+
# size = pn.size # 27662
|
28
|
+
# isdir = pn.directory? # false
|
29
|
+
# dir = pn.dirname # Pathname:/usr/bin
|
30
|
+
# base = pn.basename # Pathname:ruby
|
31
|
+
# dir, base = pn.split # [Pathname:/usr/bin, Pathname:ruby]
|
32
|
+
# data = pn.read
|
33
|
+
# pn.open { |f| _ }
|
34
|
+
# pn.each_line { |line| _ }
|
35
|
+
#
|
36
|
+
# ### Example 2: Using standard Ruby
|
37
|
+
#
|
38
|
+
# pn = "/usr/bin/ruby"
|
39
|
+
# size = File.size(pn) # 27662
|
40
|
+
# isdir = File.directory?(pn) # false
|
41
|
+
# dir = File.dirname(pn) # "/usr/bin"
|
42
|
+
# base = File.basename(pn) # "ruby"
|
43
|
+
# dir, base = File.split(pn) # ["/usr/bin", "ruby"]
|
44
|
+
# data = File.read(pn)
|
45
|
+
# File.open(pn) { |f| _ }
|
46
|
+
# File.foreach(pn) { |line| _ }
|
47
|
+
#
|
48
|
+
# ### Example 3: Special features
|
49
|
+
#
|
50
|
+
# p1 = Pathname.new("/usr/lib") # Pathname:/usr/lib
|
51
|
+
# p2 = p1 + "ruby/1.8" # Pathname:/usr/lib/ruby/1.8
|
52
|
+
# p3 = p1.parent # Pathname:/usr
|
53
|
+
# p4 = p2.relative_path_from(p3) # Pathname:lib/ruby/1.8
|
54
|
+
# pwd = Pathname.pwd # Pathname:/home/gavin
|
55
|
+
# pwd.absolute? # true
|
56
|
+
# p5 = Pathname.new "." # Pathname:.
|
57
|
+
# p5 = p5 + "music/../articles" # Pathname:music/../articles
|
58
|
+
# p5.cleanpath # Pathname:articles
|
59
|
+
# p5.realpath # Pathname:/home/gavin/articles
|
60
|
+
# p5.children # [Pathname:/home/gavin/articles/linux, ...]
|
61
|
+
#
|
62
|
+
# ## Breakdown of functionality
|
63
|
+
#
|
64
|
+
# ### Core methods
|
65
|
+
#
|
66
|
+
# These methods are effectively manipulating a String, because that's all a path
|
67
|
+
# is. None of these access the file system except for #mountpoint?, #children,
|
68
|
+
# #each_child, #realdirpath and #realpath.
|
69
|
+
#
|
70
|
+
# * +
|
71
|
+
# * #join
|
72
|
+
# * #parent
|
73
|
+
# * #root?
|
74
|
+
# * #absolute?
|
75
|
+
# * #relative?
|
76
|
+
# * #relative_path_from
|
77
|
+
# * #each_filename
|
78
|
+
# * #cleanpath
|
79
|
+
# * #realpath
|
80
|
+
# * #realdirpath
|
81
|
+
# * #children
|
82
|
+
# * #each_child
|
83
|
+
# * #mountpoint?
|
84
|
+
#
|
85
|
+
# ### File status predicate methods
|
86
|
+
#
|
87
|
+
# These methods are a facade for FileTest:
|
88
|
+
# * #blockdev?
|
89
|
+
# * #chardev?
|
90
|
+
# * #directory?
|
91
|
+
# * #executable?
|
92
|
+
# * #executable_real?
|
93
|
+
# * #exist?
|
94
|
+
# * #file?
|
95
|
+
# * #grpowned?
|
96
|
+
# * #owned?
|
97
|
+
# * #pipe?
|
98
|
+
# * #readable?
|
99
|
+
# * #world_readable?
|
100
|
+
# * #readable_real?
|
101
|
+
# * #setgid?
|
102
|
+
# * #setuid?
|
103
|
+
# * #size
|
104
|
+
# * #size?
|
105
|
+
# * #socket?
|
106
|
+
# * #sticky?
|
107
|
+
# * #symlink?
|
108
|
+
# * #writable?
|
109
|
+
# * #world_writable?
|
110
|
+
# * #writable_real?
|
111
|
+
# * #zero?
|
112
|
+
#
|
113
|
+
# ### File property and manipulation methods
|
114
|
+
#
|
115
|
+
# These methods are a facade for File:
|
116
|
+
# * #atime
|
117
|
+
# * #birthtime
|
118
|
+
# * #ctime
|
119
|
+
# * #mtime
|
120
|
+
# * #chmod(mode)
|
121
|
+
# * #lchmod(mode)
|
122
|
+
# * #chown(owner, group)
|
123
|
+
# * #lchown(owner, group)
|
124
|
+
# * #fnmatch(pattern, *args)
|
125
|
+
# * #fnmatch?(pattern, *args)
|
126
|
+
# * #ftype
|
127
|
+
# * #make_link(old)
|
128
|
+
# * #open(*args, &block)
|
129
|
+
# * #readlink
|
130
|
+
# * #rename(to)
|
131
|
+
# * #stat
|
132
|
+
# * #lstat
|
133
|
+
# * #make_symlink(old)
|
134
|
+
# * #truncate(length)
|
135
|
+
# * #utime(atime, mtime)
|
136
|
+
# * #lutime(atime, mtime)
|
137
|
+
# * #basename(*args)
|
138
|
+
# * #dirname
|
139
|
+
# * #extname
|
140
|
+
# * #expand_path(*args)
|
141
|
+
# * #split
|
142
|
+
#
|
143
|
+
# ### Directory methods
|
144
|
+
#
|
145
|
+
# These methods are a facade for Dir:
|
146
|
+
# * Pathname.glob(*args)
|
147
|
+
# * Pathname.getwd / Pathname.pwd
|
148
|
+
# * #rmdir
|
149
|
+
# * #entries
|
150
|
+
# * #each_entry(&block)
|
151
|
+
# * #mkdir(*args)
|
152
|
+
# * #opendir(*args)
|
153
|
+
#
|
154
|
+
# ### IO
|
155
|
+
#
|
156
|
+
# These methods are a facade for IO:
|
157
|
+
# * #each_line(*args, &block)
|
158
|
+
# * #read(*args)
|
159
|
+
# * #binread(*args)
|
160
|
+
# * #readlines(*args)
|
161
|
+
# * #sysopen(*args)
|
162
|
+
# * #write(*args)
|
163
|
+
# * #binwrite(*args)
|
164
|
+
#
|
165
|
+
# ### Utilities
|
166
|
+
#
|
167
|
+
# These methods are a mixture of Find, FileUtils, and others:
|
168
|
+
# * #find(&block)
|
169
|
+
# * #mkpath
|
170
|
+
# * #rmtree
|
171
|
+
# * #unlink / #delete
|
172
|
+
#
|
173
|
+
# ## Method documentation
|
174
|
+
#
|
175
|
+
# As the above section shows, most of the methods in Pathname are facades. The
|
176
|
+
# documentation for these methods generally just says, for instance, "See
|
177
|
+
# FileTest.writable?", as you should be familiar with the original method
|
178
|
+
# anyway, and its documentation (e.g. through `ri`) will contain more
|
179
|
+
# information. In some cases, a brief description will follow.
|
180
|
+
#
|
181
|
+
class Pathname
|
182
|
+
# <!--
|
183
|
+
# rdoc-file=ext/pathname/pathname.c
|
184
|
+
# - getwd()
|
185
|
+
# -->
|
186
|
+
# Returns the current working directory as a Pathname.
|
187
|
+
#
|
188
|
+
# Pathname.getwd
|
189
|
+
# #=> #<Pathname:/home/zzak/projects/ruby>
|
190
|
+
#
|
191
|
+
# See Dir.getwd.
|
192
|
+
#
|
193
|
+
def self.getwd: () -> Pathname
|
194
|
+
|
195
|
+
# <!--
|
196
|
+
# rdoc-file=ext/pathname/pathname.c
|
197
|
+
# - glob(p1, p2 = v2, p3 = v3)
|
198
|
+
# -->
|
199
|
+
# Returns or yields Pathname objects.
|
200
|
+
#
|
201
|
+
# Pathname.glob("lib/i*.rb")
|
202
|
+
# #=> [#<Pathname:lib/ipaddr.rb>, #<Pathname:lib/irb.rb>]
|
203
|
+
#
|
204
|
+
# See Dir.glob.
|
205
|
+
#
|
206
|
+
def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
207
|
+
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
208
|
+
|
209
|
+
# <!--
|
210
|
+
# rdoc-file=ext/pathname/pathname.c
|
211
|
+
# - pwd()
|
212
|
+
# -->
|
213
|
+
# Returns the current working directory as a Pathname.
|
214
|
+
#
|
215
|
+
# Pathname.getwd
|
216
|
+
# #=> #<Pathname:/home/zzak/projects/ruby>
|
217
|
+
#
|
218
|
+
# See Dir.getwd.
|
219
|
+
#
|
220
|
+
def self.pwd: () -> Pathname
|
221
|
+
|
222
|
+
# <!--
|
223
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
224
|
+
# - +(other)
|
225
|
+
# -->
|
226
|
+
# Appends a pathname fragment to `self` to produce a new Pathname object. Since
|
227
|
+
# `other` is considered as a path relative to `self`, if `other` is an absolute
|
228
|
+
# path, the new Pathname object is created from just `other`.
|
229
|
+
#
|
230
|
+
# p1 = Pathname.new("/usr") # Pathname:/usr
|
231
|
+
# p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
|
232
|
+
# p3 = p1 + "/etc/passwd" # Pathname:/etc/passwd
|
233
|
+
#
|
234
|
+
# # / is aliased to +.
|
235
|
+
# p4 = p1 / "bin/ruby" # Pathname:/usr/bin/ruby
|
236
|
+
# p5 = p1 / "/etc/passwd" # Pathname:/etc/passwd
|
237
|
+
#
|
238
|
+
# This method doesn't access the file system; it is pure string manipulation.
|
239
|
+
#
|
240
|
+
def +: (Pathname | String | _ToStr other) -> Pathname
|
241
|
+
|
242
|
+
# <!--
|
243
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
244
|
+
# - /(other)
|
245
|
+
# -->
|
246
|
+
#
|
247
|
+
alias / +
|
248
|
+
|
249
|
+
# <!--
|
250
|
+
# rdoc-file=ext/pathname/pathname.c
|
251
|
+
# - <=>(p1)
|
252
|
+
# -->
|
253
|
+
# Provides a case-sensitive comparison operator for pathnames.
|
254
|
+
#
|
255
|
+
# Pathname.new('/usr') <=> Pathname.new('/usr/bin')
|
256
|
+
# #=> -1
|
257
|
+
# Pathname.new('/usr/bin') <=> Pathname.new('/usr/bin')
|
258
|
+
# #=> 0
|
259
|
+
# Pathname.new('/usr/bin') <=> Pathname.new('/USR/BIN')
|
260
|
+
# #=> 1
|
261
|
+
#
|
262
|
+
# It will return `-1`, `0` or `1` depending on the value of the left argument
|
263
|
+
# relative to the right argument. Or it will return `nil` if the arguments are
|
264
|
+
# not comparable.
|
265
|
+
#
|
266
|
+
def <=>: (Pathname other) -> Integer
|
267
|
+
| (untyped other) -> nil
|
268
|
+
|
269
|
+
# <!--
|
270
|
+
# rdoc-file=ext/pathname/pathname.c
|
271
|
+
# - ==(p1)
|
272
|
+
# -->
|
273
|
+
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
274
|
+
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
275
|
+
# file.
|
276
|
+
#
|
277
|
+
def ==: (untyped) -> bool
|
278
|
+
|
279
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
280
|
+
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
281
|
+
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
282
|
+
# file.
|
283
|
+
#
|
284
|
+
def ===: (untyped) -> bool
|
285
|
+
|
286
|
+
# <!--
|
287
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
288
|
+
# - absolute?()
|
289
|
+
# -->
|
290
|
+
# Predicate method for testing whether a path is absolute.
|
291
|
+
#
|
292
|
+
# It returns `true` if the pathname begins with a slash.
|
293
|
+
#
|
294
|
+
# p = Pathname.new('/im/sure')
|
295
|
+
# p.absolute?
|
296
|
+
# #=> true
|
297
|
+
#
|
298
|
+
# p = Pathname.new('not/so/sure')
|
299
|
+
# p.absolute?
|
300
|
+
# #=> false
|
301
|
+
#
|
302
|
+
def absolute?: () -> bool
|
303
|
+
|
304
|
+
# <!--
|
305
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
306
|
+
# - ascend() { |self| ... }
|
307
|
+
# -->
|
308
|
+
# Iterates over and yields a new Pathname object for each element in the given
|
309
|
+
# path in ascending order.
|
310
|
+
#
|
311
|
+
# Pathname.new('/path/to/some/file.rb').ascend {|v| p v}
|
312
|
+
# #<Pathname:/path/to/some/file.rb>
|
313
|
+
# #<Pathname:/path/to/some>
|
314
|
+
# #<Pathname:/path/to>
|
315
|
+
# #<Pathname:/path>
|
316
|
+
# #<Pathname:/>
|
317
|
+
#
|
318
|
+
# Pathname.new('path/to/some/file.rb').ascend {|v| p v}
|
319
|
+
# #<Pathname:path/to/some/file.rb>
|
320
|
+
# #<Pathname:path/to/some>
|
321
|
+
# #<Pathname:path/to>
|
322
|
+
# #<Pathname:path>
|
323
|
+
#
|
324
|
+
# Returns an Enumerator if no block was given.
|
325
|
+
#
|
326
|
+
# enum = Pathname.new("/usr/bin/ruby").ascend
|
327
|
+
# # ... do stuff ...
|
328
|
+
# enum.each { |e| ... }
|
329
|
+
# # yields Pathnames /usr/bin/ruby, /usr/bin, /usr, and /.
|
330
|
+
#
|
331
|
+
# It doesn't access the filesystem.
|
332
|
+
#
|
333
|
+
def ascend: () { (Pathname) -> untyped } -> nil
|
334
|
+
| () -> Enumerator[Pathname, nil]
|
335
|
+
|
336
|
+
# <!--
|
337
|
+
# rdoc-file=ext/pathname/pathname.c
|
338
|
+
# - pathname.atime -> time
|
339
|
+
# -->
|
340
|
+
# Returns the last access time for the file.
|
341
|
+
#
|
342
|
+
# See File.atime.
|
343
|
+
#
|
344
|
+
def atime: () -> Time
|
345
|
+
|
346
|
+
# <!--
|
347
|
+
# rdoc-file=ext/pathname/pathname.c
|
348
|
+
# - basename(p1 = v1)
|
349
|
+
# -->
|
350
|
+
# Returns the last component of the path.
|
351
|
+
#
|
352
|
+
# See File.basename.
|
353
|
+
#
|
354
|
+
def basename: (?String | _ToStr suffix) -> Pathname
|
355
|
+
|
356
|
+
# <!--
|
357
|
+
# rdoc-file=ext/pathname/pathname.c
|
358
|
+
# - pathname.binread([length [, offset]]) -> string
|
359
|
+
# -->
|
360
|
+
# Returns all the bytes from the file, or the first `N` if specified.
|
361
|
+
#
|
362
|
+
# See File.binread.
|
363
|
+
#
|
364
|
+
def binread: (?Integer length, ?Integer offset) -> String
|
365
|
+
|
366
|
+
# <!--
|
367
|
+
# rdoc-file=ext/pathname/pathname.c
|
368
|
+
# - pathname.binwrite(string, [offset] ) => fixnum
|
369
|
+
# - pathname.binwrite(string, [offset], open_args ) => fixnum
|
370
|
+
# -->
|
371
|
+
# Writes `contents` to the file, opening it in binary mode.
|
372
|
+
#
|
373
|
+
# See File.binwrite.
|
374
|
+
#
|
375
|
+
def binwrite: (String, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?invalid: :replace ?, ?undef: :replace ?, ?replace: String, ?fallback: Hash[String, String] | Proc | Method, ?xml: :text | :attr, ?universal_newline: true, ?cr_newline: true, ?crlf_newline: true) -> Integer
|
376
|
+
|
377
|
+
# <!--
|
378
|
+
# rdoc-file=ext/pathname/pathname.c
|
379
|
+
# - pathname.birthtime -> time
|
380
|
+
# -->
|
381
|
+
# Returns the birth time for the file. If the platform doesn't have birthtime,
|
382
|
+
# raises NotImplementedError.
|
383
|
+
#
|
384
|
+
# See File.birthtime.
|
385
|
+
#
|
386
|
+
def birthtime: () -> Time
|
387
|
+
|
388
|
+
# <!--
|
389
|
+
# rdoc-file=ext/pathname/pathname.c
|
390
|
+
# - blockdev?()
|
391
|
+
# -->
|
392
|
+
# See FileTest.blockdev?.
|
393
|
+
#
|
394
|
+
def blockdev?: () -> bool
|
395
|
+
|
396
|
+
# <!--
|
397
|
+
# rdoc-file=ext/pathname/pathname.c
|
398
|
+
# - chardev?()
|
399
|
+
# -->
|
400
|
+
# See FileTest.chardev?.
|
401
|
+
#
|
402
|
+
def chardev?: () -> bool
|
403
|
+
|
404
|
+
# <!--
|
405
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
406
|
+
# - children(with_directory=true)
|
407
|
+
# -->
|
408
|
+
# Returns the children of the directory (files and subdirectories, not
|
409
|
+
# recursive) as an array of Pathname objects.
|
410
|
+
#
|
411
|
+
# By default, the returned pathnames will have enough information to access the
|
412
|
+
# files. If you set `with_directory` to `false`, then the returned pathnames
|
413
|
+
# will contain the filename only.
|
414
|
+
#
|
415
|
+
# For example:
|
416
|
+
# pn = Pathname("/usr/lib/ruby/1.8")
|
417
|
+
# pn.children
|
418
|
+
# # -> [ Pathname:/usr/lib/ruby/1.8/English.rb,
|
419
|
+
# Pathname:/usr/lib/ruby/1.8/Env.rb,
|
420
|
+
# Pathname:/usr/lib/ruby/1.8/abbrev.rb, ... ]
|
421
|
+
# pn.children(false)
|
422
|
+
# # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
|
423
|
+
#
|
424
|
+
# Note that the results never contain the entries `.` and `..` in the directory
|
425
|
+
# because they are not children.
|
426
|
+
#
|
427
|
+
def children: (?boolish with_directory) -> Array[Pathname]
|
428
|
+
|
429
|
+
# <!--
|
430
|
+
# rdoc-file=ext/pathname/pathname.c
|
431
|
+
# - pathname.chmod(mode_int) -> integer
|
432
|
+
# -->
|
433
|
+
# Changes file permissions.
|
434
|
+
#
|
435
|
+
# See File.chmod.
|
436
|
+
#
|
437
|
+
def chmod: (Integer mode_int) -> Integer
|
438
|
+
|
439
|
+
# <!--
|
440
|
+
# rdoc-file=ext/pathname/pathname.c
|
441
|
+
# - pathname.chown(owner_int, group_int) -> integer
|
442
|
+
# -->
|
443
|
+
# Change owner and group of the file.
|
444
|
+
#
|
445
|
+
# See File.chown.
|
446
|
+
#
|
447
|
+
def chown: (Integer owner, Integer group) -> Integer
|
448
|
+
|
449
|
+
# <!--
|
450
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
451
|
+
# - cleanpath(consider_symlink=false)
|
452
|
+
# -->
|
453
|
+
# Returns clean pathname of `self` with consecutive slashes and useless dots
|
454
|
+
# removed. The filesystem is not accessed.
|
455
|
+
#
|
456
|
+
# If `consider_symlink` is `true`, then a more conservative algorithm is used to
|
457
|
+
# avoid breaking symbolic linkages. This may retain more `..` entries than
|
458
|
+
# absolutely necessary, but without accessing the filesystem, this can't be
|
459
|
+
# avoided.
|
460
|
+
#
|
461
|
+
# See Pathname#realpath.
|
462
|
+
#
|
463
|
+
def cleanpath: (?boolish consider_symlink) -> Pathname
|
464
|
+
|
465
|
+
# <!--
|
466
|
+
# rdoc-file=ext/pathname/pathname.c
|
467
|
+
# - pathname.ctime -> time
|
468
|
+
# -->
|
469
|
+
# Returns the last change time, using directory information, not the file
|
470
|
+
# itself.
|
471
|
+
#
|
472
|
+
# See File.ctime.
|
473
|
+
#
|
474
|
+
def ctime: () -> Time
|
475
|
+
|
476
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
477
|
+
# Removes a file or directory, using File.unlink if `self` is a file, or
|
478
|
+
# Dir.unlink as necessary.
|
479
|
+
#
|
480
|
+
def delete: () -> Integer
|
481
|
+
|
482
|
+
# <!--
|
483
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
484
|
+
# - descend() { |v| ... }
|
485
|
+
# -->
|
486
|
+
# Iterates over and yields a new Pathname object for each element in the given
|
487
|
+
# path in descending order.
|
488
|
+
#
|
489
|
+
# Pathname.new('/path/to/some/file.rb').descend {|v| p v}
|
490
|
+
# #<Pathname:/>
|
491
|
+
# #<Pathname:/path>
|
492
|
+
# #<Pathname:/path/to>
|
493
|
+
# #<Pathname:/path/to/some>
|
494
|
+
# #<Pathname:/path/to/some/file.rb>
|
495
|
+
#
|
496
|
+
# Pathname.new('path/to/some/file.rb').descend {|v| p v}
|
497
|
+
# #<Pathname:path>
|
498
|
+
# #<Pathname:path/to>
|
499
|
+
# #<Pathname:path/to/some>
|
500
|
+
# #<Pathname:path/to/some/file.rb>
|
501
|
+
#
|
502
|
+
# Returns an Enumerator if no block was given.
|
503
|
+
#
|
504
|
+
# enum = Pathname.new("/usr/bin/ruby").descend
|
505
|
+
# # ... do stuff ...
|
506
|
+
# enum.each { |e| ... }
|
507
|
+
# # yields Pathnames /, /usr, /usr/bin, and /usr/bin/ruby.
|
508
|
+
#
|
509
|
+
# It doesn't access the filesystem.
|
510
|
+
#
|
511
|
+
def descend: () { (Pathname) -> untyped } -> nil
|
512
|
+
| () -> Enumerator[Pathname, nil]
|
513
|
+
|
514
|
+
# <!--
|
515
|
+
# rdoc-file=ext/pathname/pathname.c
|
516
|
+
# - directory?()
|
517
|
+
# -->
|
518
|
+
# See FileTest.directory?.
|
519
|
+
#
|
520
|
+
def directory?: () -> bool
|
521
|
+
|
522
|
+
# <!--
|
523
|
+
# rdoc-file=ext/pathname/pathname.c
|
524
|
+
# - dirname()
|
525
|
+
# -->
|
526
|
+
# Returns all but the last component of the path.
|
527
|
+
#
|
528
|
+
# See File.dirname.
|
529
|
+
#
|
530
|
+
def dirname: () -> Pathname
|
531
|
+
|
532
|
+
# <!--
|
533
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
534
|
+
# - each_child(with_directory=true, &b)
|
535
|
+
# -->
|
536
|
+
# Iterates over the children of the directory (files and subdirectories, not
|
537
|
+
# recursive).
|
538
|
+
#
|
539
|
+
# It yields Pathname object for each child.
|
540
|
+
#
|
541
|
+
# By default, the yielded pathnames will have enough information to access the
|
542
|
+
# files.
|
543
|
+
#
|
544
|
+
# If you set `with_directory` to `false`, then the returned pathnames will
|
545
|
+
# contain the filename only.
|
546
|
+
#
|
547
|
+
# Pathname("/usr/local").each_child {|f| p f }
|
548
|
+
# #=> #<Pathname:/usr/local/share>
|
549
|
+
# # #<Pathname:/usr/local/bin>
|
550
|
+
# # #<Pathname:/usr/local/games>
|
551
|
+
# # #<Pathname:/usr/local/lib>
|
552
|
+
# # #<Pathname:/usr/local/include>
|
553
|
+
# # #<Pathname:/usr/local/sbin>
|
554
|
+
# # #<Pathname:/usr/local/src>
|
555
|
+
# # #<Pathname:/usr/local/man>
|
556
|
+
#
|
557
|
+
# Pathname("/usr/local").each_child(false) {|f| p f }
|
558
|
+
# #=> #<Pathname:share>
|
559
|
+
# # #<Pathname:bin>
|
560
|
+
# # #<Pathname:games>
|
561
|
+
# # #<Pathname:lib>
|
562
|
+
# # #<Pathname:include>
|
563
|
+
# # #<Pathname:sbin>
|
564
|
+
# # #<Pathname:src>
|
565
|
+
# # #<Pathname:man>
|
566
|
+
#
|
567
|
+
# Note that the results never contain the entries `.` and `..` in the directory
|
568
|
+
# because they are not children.
|
569
|
+
#
|
570
|
+
# See Pathname#children
|
571
|
+
#
|
572
|
+
def each_child: (?boolish with_directory) { (Pathname) -> void } -> Array[Pathname]
|
573
|
+
| (?boolish with_directory) -> Enumerator[Pathname, Array[Pathname]]
|
574
|
+
|
575
|
+
# <!--
|
576
|
+
# rdoc-file=ext/pathname/pathname.c
|
577
|
+
# - each_entry()
|
578
|
+
# -->
|
579
|
+
# Iterates over the entries (files and subdirectories) in the directory,
|
580
|
+
# yielding a Pathname object for each entry.
|
581
|
+
#
|
582
|
+
def each_entry: () { (Pathname) -> untyped } -> nil
|
583
|
+
|
584
|
+
# <!--
|
585
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
586
|
+
# - each_filename() { |filename| ... }
|
587
|
+
# -->
|
588
|
+
# Iterates over each component of the path.
|
589
|
+
#
|
590
|
+
# Pathname.new("/usr/bin/ruby").each_filename {|filename| ... }
|
591
|
+
# # yields "usr", "bin", and "ruby".
|
592
|
+
#
|
593
|
+
# Returns an Enumerator if no block was given.
|
594
|
+
#
|
595
|
+
# enum = Pathname.new("/usr/bin/ruby").each_filename
|
596
|
+
# # ... do stuff ...
|
597
|
+
# enum.each { |e| ... }
|
598
|
+
# # yields "usr", "bin", and "ruby".
|
599
|
+
#
|
600
|
+
def each_filename: () { (String) -> untyped } -> nil
|
601
|
+
| () -> Enumerator[String, nil]
|
602
|
+
|
603
|
+
# <!--
|
604
|
+
# rdoc-file=ext/pathname/pathname.c
|
605
|
+
# - pathname.each_line {|line| ... }
|
606
|
+
# - pathname.each_line(sep=$/ [, open_args]) {|line| block } -> nil
|
607
|
+
# - pathname.each_line(limit [, open_args]) {|line| block } -> nil
|
608
|
+
# - pathname.each_line(sep, limit [, open_args]) {|line| block } -> nil
|
609
|
+
# - pathname.each_line(...) -> an_enumerator
|
610
|
+
# -->
|
611
|
+
# Iterates over each line in the file and yields a String object for each.
|
612
|
+
#
|
613
|
+
def each_line: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) { (String) -> untyped } -> nil
|
614
|
+
| (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) { (String) -> untyped } -> nil
|
615
|
+
| (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Enumerator[String, nil]
|
616
|
+
| (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Enumerator[String, nil]
|
617
|
+
|
618
|
+
# <!--
|
619
|
+
# rdoc-file=ext/pathname/pathname.c
|
620
|
+
# - empty?()
|
621
|
+
# -->
|
622
|
+
# Tests the file is empty.
|
623
|
+
#
|
624
|
+
# See Dir#empty? and FileTest.empty?.
|
625
|
+
#
|
626
|
+
def empty?: () -> bool
|
627
|
+
|
628
|
+
# <!--
|
629
|
+
# rdoc-file=ext/pathname/pathname.c
|
630
|
+
# - entries()
|
631
|
+
# -->
|
632
|
+
# Return the entries (files and subdirectories) in the directory, each as a
|
633
|
+
# Pathname object.
|
634
|
+
#
|
635
|
+
# The results contains just the names in the directory, without any trailing
|
636
|
+
# slashes or recursive look-up.
|
637
|
+
#
|
638
|
+
# pp Pathname.new('/usr/local').entries
|
639
|
+
# #=> [#<Pathname:share>,
|
640
|
+
# # #<Pathname:lib>,
|
641
|
+
# # #<Pathname:..>,
|
642
|
+
# # #<Pathname:include>,
|
643
|
+
# # #<Pathname:etc>,
|
644
|
+
# # #<Pathname:bin>,
|
645
|
+
# # #<Pathname:man>,
|
646
|
+
# # #<Pathname:games>,
|
647
|
+
# # #<Pathname:.>,
|
648
|
+
# # #<Pathname:sbin>,
|
649
|
+
# # #<Pathname:src>]
|
650
|
+
#
|
651
|
+
# The result may contain the current directory `#<Pathname:.>` and the parent
|
652
|
+
# directory `#<Pathname:..>`.
|
653
|
+
#
|
654
|
+
# If you don't want `.` and `..` and want directories, consider
|
655
|
+
# Pathname#children.
|
656
|
+
#
|
657
|
+
def entries: () -> Array[Pathname]
|
658
|
+
|
659
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
660
|
+
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
661
|
+
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
662
|
+
# file.
|
663
|
+
#
|
664
|
+
def eql?: (untyped) -> bool
|
665
|
+
|
666
|
+
# <!--
|
667
|
+
# rdoc-file=ext/pathname/pathname.c
|
668
|
+
# - executable?()
|
669
|
+
# -->
|
670
|
+
# See FileTest.executable?.
|
671
|
+
#
|
672
|
+
def executable?: () -> bool
|
673
|
+
|
674
|
+
# <!--
|
675
|
+
# rdoc-file=ext/pathname/pathname.c
|
676
|
+
# - executable_real?()
|
677
|
+
# -->
|
678
|
+
# See FileTest.executable_real?.
|
679
|
+
#
|
680
|
+
def executable_real?: () -> bool
|
681
|
+
|
682
|
+
# <!--
|
683
|
+
# rdoc-file=ext/pathname/pathname.c
|
684
|
+
# - exist?()
|
685
|
+
# -->
|
686
|
+
# See FileTest.exist?.
|
687
|
+
#
|
688
|
+
def exist?: () -> bool
|
689
|
+
|
690
|
+
# <!--
|
691
|
+
# rdoc-file=ext/pathname/pathname.c
|
692
|
+
# - expand_path(p1 = v1)
|
693
|
+
# -->
|
694
|
+
# Returns the absolute path for the file.
|
695
|
+
#
|
696
|
+
# See File.expand_path.
|
697
|
+
#
|
698
|
+
def expand_path: (?String dir) -> Pathname
|
699
|
+
|
700
|
+
# <!--
|
701
|
+
# rdoc-file=ext/pathname/pathname.c
|
702
|
+
# - extname()
|
703
|
+
# -->
|
704
|
+
# Returns the file's extension.
|
705
|
+
#
|
706
|
+
# See File.extname.
|
707
|
+
#
|
708
|
+
def extname: () -> String
|
709
|
+
|
710
|
+
# <!--
|
711
|
+
# rdoc-file=ext/pathname/pathname.c
|
712
|
+
# - file?()
|
713
|
+
# -->
|
714
|
+
# See FileTest.file?.
|
715
|
+
#
|
716
|
+
def file?: () -> bool
|
717
|
+
|
718
|
+
# <!--
|
719
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
720
|
+
# - find(ignore_error: true) { |pathname| ... }
|
721
|
+
# -->
|
722
|
+
# Iterates over the directory tree in a depth first manner, yielding a Pathname
|
723
|
+
# for each file under "this" directory.
|
724
|
+
#
|
725
|
+
# Returns an Enumerator if no block is given.
|
726
|
+
#
|
727
|
+
# Since it is implemented by the standard library module Find, Find.prune can be
|
728
|
+
# used to control the traversal.
|
729
|
+
#
|
730
|
+
# If `self` is `.`, yielded pathnames begin with a filename in the current
|
731
|
+
# directory, not `./`.
|
732
|
+
#
|
733
|
+
# See Find.find
|
734
|
+
#
|
735
|
+
def find: (?ignore_error: boolish) { (Pathname) -> untyped } -> nil
|
736
|
+
| (?ignore_error: boolish) -> Enumerator[Pathname, nil]
|
737
|
+
|
738
|
+
# <!--
|
739
|
+
# rdoc-file=ext/pathname/pathname.c
|
740
|
+
# - pathname.fnmatch(pattern, [flags]) -> true or false
|
741
|
+
# - pathname.fnmatch?(pattern, [flags]) -> true or false
|
742
|
+
# -->
|
743
|
+
# Return `true` if the receiver matches the given pattern.
|
744
|
+
#
|
745
|
+
# See File.fnmatch.
|
746
|
+
#
|
747
|
+
def fnmatch: (String pattern, ?Integer flags) -> bool
|
748
|
+
|
749
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
750
|
+
# Return `true` if the receiver matches the given pattern.
|
751
|
+
#
|
752
|
+
# See File.fnmatch.
|
753
|
+
#
|
754
|
+
alias fnmatch? fnmatch
|
755
|
+
|
756
|
+
# <!--
|
757
|
+
# rdoc-file=ext/pathname/pathname.c
|
758
|
+
# - pathname.freeze -> obj
|
759
|
+
# -->
|
760
|
+
# Freezes this Pathname.
|
761
|
+
#
|
762
|
+
# See Object.freeze.
|
763
|
+
#
|
764
|
+
def freeze: () -> Pathname
|
765
|
+
|
766
|
+
# <!--
|
767
|
+
# rdoc-file=ext/pathname/pathname.c
|
768
|
+
# - pathname.ftype -> string
|
769
|
+
# -->
|
770
|
+
# Returns "type" of file ("file", "directory", etc).
|
771
|
+
#
|
772
|
+
# See File.ftype.
|
773
|
+
#
|
774
|
+
def ftype: () -> String
|
775
|
+
|
776
|
+
# <!--
|
777
|
+
# rdoc-file=ext/pathname/pathname.c
|
778
|
+
# - glob(p1, p2 = v2)
|
779
|
+
# -->
|
780
|
+
# Returns or yields Pathname objects.
|
781
|
+
#
|
782
|
+
# Pathname("ruby-2.4.2").glob("R*.md")
|
783
|
+
# #=> [#<Pathname:ruby-2.4.2/README.md>, #<Pathname:ruby-2.4.2/README.ja.md>]
|
784
|
+
#
|
785
|
+
# See Dir.glob. This method uses the `base` keyword argument of Dir.glob.
|
786
|
+
#
|
787
|
+
def glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
788
|
+
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
789
|
+
|
790
|
+
# <!--
|
791
|
+
# rdoc-file=ext/pathname/pathname.c
|
792
|
+
# - grpowned?()
|
793
|
+
# -->
|
794
|
+
# See FileTest.grpowned?.
|
795
|
+
#
|
796
|
+
def grpowned?: () -> bool
|
797
|
+
|
798
|
+
def hash: () -> Integer
|
799
|
+
|
800
|
+
def inspect: () -> String
|
801
|
+
|
802
|
+
# <!--
|
803
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
804
|
+
# - join(*args)
|
805
|
+
# -->
|
806
|
+
# Joins the given pathnames onto `self` to create a new Pathname object. This is
|
807
|
+
# effectively the same as using Pathname#+ to append `self` and all arguments
|
808
|
+
# sequentially.
|
809
|
+
#
|
810
|
+
# path0 = Pathname.new("/usr") # Pathname:/usr
|
811
|
+
# path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
|
812
|
+
# # is the same as
|
813
|
+
# path1 = Pathname.new("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
|
814
|
+
# path0 == path1
|
815
|
+
# #=> true
|
816
|
+
#
|
817
|
+
def join: (*String | _ToStr | Pathname args) -> Pathname
|
818
|
+
|
819
|
+
# <!--
|
820
|
+
# rdoc-file=ext/pathname/pathname.c
|
821
|
+
# - pathname.lchmod(mode_int) -> integer
|
822
|
+
# -->
|
823
|
+
# Same as Pathname.chmod, but does not follow symbolic links.
|
824
|
+
#
|
825
|
+
# See File.lchmod.
|
826
|
+
#
|
827
|
+
def lchmod: (Integer mode) -> Integer
|
828
|
+
|
829
|
+
# <!--
|
830
|
+
# rdoc-file=ext/pathname/pathname.c
|
831
|
+
# - pathname.lchown(owner_int, group_int) -> integer
|
832
|
+
# -->
|
833
|
+
# Same as Pathname.chown, but does not follow symbolic links.
|
834
|
+
#
|
835
|
+
# See File.lchown.
|
836
|
+
#
|
837
|
+
def lchown: (Integer owner, Integer group) -> Integer
|
838
|
+
|
839
|
+
# <!--
|
840
|
+
# rdoc-file=ext/pathname/pathname.c
|
841
|
+
# - lstat()
|
842
|
+
# -->
|
843
|
+
# See File.lstat.
|
844
|
+
#
|
845
|
+
def lstat: () -> ::File::Stat
|
846
|
+
|
847
|
+
# <!--
|
848
|
+
# rdoc-file=ext/pathname/pathname.c
|
849
|
+
# - lutime(p1, p2)
|
850
|
+
# -->
|
851
|
+
# Update the access and modification times of the file.
|
852
|
+
#
|
853
|
+
# Same as Pathname#utime, but does not follow symbolic links.
|
854
|
+
#
|
855
|
+
# See File.lutime.
|
856
|
+
#
|
857
|
+
def lutime: (Time | Numeric atime, Time | Numeric mtime) -> Integer
|
858
|
+
|
859
|
+
# <!--
|
860
|
+
# rdoc-file=ext/pathname/pathname.c
|
861
|
+
# - pathname.make_link(old)
|
862
|
+
# -->
|
863
|
+
# Creates a hard link at *pathname*.
|
864
|
+
#
|
865
|
+
# See File.link.
|
866
|
+
#
|
867
|
+
def make_link: (String | Pathname | _ToStr old) -> Integer
|
868
|
+
|
869
|
+
# <!--
|
870
|
+
# rdoc-file=ext/pathname/pathname.c
|
871
|
+
# - pathname.make_symlink(old)
|
872
|
+
# -->
|
873
|
+
# Creates a symbolic link.
|
874
|
+
#
|
875
|
+
# See File.symlink.
|
876
|
+
#
|
877
|
+
def make_symlink: (String | Pathname | _ToStr old) -> Integer
|
878
|
+
|
879
|
+
# <!--
|
880
|
+
# rdoc-file=ext/pathname/pathname.c
|
881
|
+
# - mkdir(p1 = v1)
|
882
|
+
# -->
|
883
|
+
# Create the referenced directory.
|
884
|
+
#
|
885
|
+
# See Dir.mkdir.
|
886
|
+
#
|
887
|
+
def mkdir: (?Integer perm) -> Integer
|
888
|
+
|
889
|
+
# <!--
|
890
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
891
|
+
# - mkpath(mode: nil)
|
892
|
+
# -->
|
893
|
+
# Creates a full path, including any intermediate directories that don't yet
|
894
|
+
# exist.
|
895
|
+
#
|
896
|
+
# See FileUtils.mkpath and FileUtils.mkdir_p
|
897
|
+
#
|
898
|
+
def mkpath: () -> self
|
899
|
+
|
900
|
+
# <!--
|
901
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
902
|
+
# - mountpoint?()
|
903
|
+
# -->
|
904
|
+
# Returns `true` if `self` points to a mountpoint.
|
905
|
+
#
|
906
|
+
def mountpoint?: () -> bool
|
907
|
+
|
908
|
+
# <!--
|
909
|
+
# rdoc-file=ext/pathname/pathname.c
|
910
|
+
# - pathname.mtime -> time
|
911
|
+
# -->
|
912
|
+
# Returns the last modified time of the file.
|
913
|
+
#
|
914
|
+
# See File.mtime.
|
915
|
+
#
|
916
|
+
def mtime: () -> Time
|
917
|
+
|
918
|
+
# <!--
|
919
|
+
# rdoc-file=ext/pathname/pathname.c
|
920
|
+
# - pathname.open()
|
921
|
+
# - pathname.open(mode="r" [, opt]) -> file
|
922
|
+
# - pathname.open([mode [, perm]] [, opt]) -> file
|
923
|
+
# - pathname.open(mode="r" [, opt]) {|file| block } -> obj
|
924
|
+
# - pathname.open([mode [, perm]] [, opt]) {|file| block } -> obj
|
925
|
+
# -->
|
926
|
+
# Opens the file for reading or writing.
|
927
|
+
#
|
928
|
+
# See File.open.
|
929
|
+
#
|
930
|
+
def open: (?string | int mode, ?int perm) -> File
|
931
|
+
| [T] (?string | int mode, ?int perm) { (File) -> T } -> T
|
932
|
+
|
933
|
+
# <!--
|
934
|
+
# rdoc-file=ext/pathname/pathname.c
|
935
|
+
# - opendir()
|
936
|
+
# -->
|
937
|
+
# Opens the referenced directory.
|
938
|
+
#
|
939
|
+
# See Dir.open.
|
940
|
+
#
|
941
|
+
def opendir: () -> Dir
|
942
|
+
| [U] () { (Dir) -> U } -> U
|
943
|
+
|
944
|
+
# <!--
|
945
|
+
# rdoc-file=ext/pathname/pathname.c
|
946
|
+
# - owned?()
|
947
|
+
# -->
|
948
|
+
# See FileTest.owned?.
|
949
|
+
#
|
950
|
+
def owned?: () -> bool
|
951
|
+
|
952
|
+
# <!--
|
953
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
954
|
+
# - parent()
|
955
|
+
# -->
|
956
|
+
# Returns the parent directory.
|
957
|
+
#
|
958
|
+
# This is same as `self + '..'`.
|
959
|
+
#
|
960
|
+
def parent: () -> Pathname
|
961
|
+
|
962
|
+
# <!--
|
963
|
+
# rdoc-file=ext/pathname/pathname.c
|
964
|
+
# - pipe?()
|
965
|
+
# -->
|
966
|
+
# See FileTest.pipe?.
|
967
|
+
#
|
968
|
+
def pipe?: () -> bool
|
969
|
+
|
970
|
+
# <!--
|
971
|
+
# rdoc-file=ext/pathname/pathname.c
|
972
|
+
# - pathname.read([length [, offset]]) -> string
|
973
|
+
# - pathname.read([length [, offset]], open_args) -> string
|
974
|
+
# -->
|
975
|
+
# Returns all data from the file, or the first `N` bytes if specified.
|
976
|
+
#
|
977
|
+
# See File.read.
|
978
|
+
#
|
979
|
+
def read: (?Integer length, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> String
|
980
|
+
|
981
|
+
# <!--
|
982
|
+
# rdoc-file=ext/pathname/pathname.c
|
983
|
+
# - readable?()
|
984
|
+
# -->
|
985
|
+
# See FileTest.readable?.
|
986
|
+
#
|
987
|
+
def readable?: () -> bool
|
988
|
+
|
989
|
+
# <!--
|
990
|
+
# rdoc-file=ext/pathname/pathname.c
|
991
|
+
# - readable_real?()
|
992
|
+
# -->
|
993
|
+
# See FileTest.readable_real?.
|
994
|
+
#
|
995
|
+
def readable_real?: () -> bool
|
996
|
+
|
997
|
+
# <!--
|
998
|
+
# rdoc-file=ext/pathname/pathname.c
|
999
|
+
# - pathname.readlines(sep=$/ [, open_args]) -> array
|
1000
|
+
# - pathname.readlines(limit [, open_args]) -> array
|
1001
|
+
# - pathname.readlines(sep, limit [, open_args]) -> array
|
1002
|
+
# -->
|
1003
|
+
# Returns all the lines from the file.
|
1004
|
+
#
|
1005
|
+
# See File.readlines.
|
1006
|
+
#
|
1007
|
+
def readlines: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
|
1008
|
+
| (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
|
1009
|
+
|
1010
|
+
# <!--
|
1011
|
+
# rdoc-file=ext/pathname/pathname.c
|
1012
|
+
# - readlink()
|
1013
|
+
# -->
|
1014
|
+
# Read symbolic link.
|
1015
|
+
#
|
1016
|
+
# See File.readlink.
|
1017
|
+
#
|
1018
|
+
def readlink: () -> untyped
|
1019
|
+
|
1020
|
+
# <!--
|
1021
|
+
# rdoc-file=ext/pathname/pathname.c
|
1022
|
+
# - realdirpath(p1 = v1)
|
1023
|
+
# -->
|
1024
|
+
# Returns the real (absolute) pathname of `self` in the actual filesystem.
|
1025
|
+
#
|
1026
|
+
# Does not contain symlinks or useless dots, `..` and `.`.
|
1027
|
+
#
|
1028
|
+
# The last component of the real pathname can be nonexistent.
|
1029
|
+
#
|
1030
|
+
def realdirpath: (?string | Pathname base_dir) -> Pathname
|
1031
|
+
|
1032
|
+
# <!--
|
1033
|
+
# rdoc-file=ext/pathname/pathname.c
|
1034
|
+
# - realpath(p1 = v1)
|
1035
|
+
# -->
|
1036
|
+
# Returns the real (absolute) pathname for `self` in the actual filesystem.
|
1037
|
+
#
|
1038
|
+
# Does not contain symlinks or useless dots, `..` and `.`.
|
1039
|
+
#
|
1040
|
+
# All components of the pathname must exist when this method is called.
|
1041
|
+
#
|
1042
|
+
def realpath: (?string | Pathname base_dir) -> Pathname
|
1043
|
+
|
1044
|
+
# <!--
|
1045
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
1046
|
+
# - relative?()
|
1047
|
+
# -->
|
1048
|
+
# The opposite of Pathname#absolute?
|
1049
|
+
#
|
1050
|
+
# It returns `false` if the pathname begins with a slash.
|
1051
|
+
#
|
1052
|
+
# p = Pathname.new('/im/sure')
|
1053
|
+
# p.relative?
|
1054
|
+
# #=> false
|
1055
|
+
#
|
1056
|
+
# p = Pathname.new('not/so/sure')
|
1057
|
+
# p.relative?
|
1058
|
+
# #=> true
|
1059
|
+
#
|
1060
|
+
def relative?: () -> bool
|
1061
|
+
|
1062
|
+
# <!--
|
1063
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
1064
|
+
# - relative_path_from(base_directory)
|
1065
|
+
# -->
|
1066
|
+
# Returns a relative path from the given `base_directory` to the receiver.
|
1067
|
+
#
|
1068
|
+
# If `self` is absolute, then `base_directory` must be absolute too.
|
1069
|
+
#
|
1070
|
+
# If `self` is relative, then `base_directory` must be relative too.
|
1071
|
+
#
|
1072
|
+
# This method doesn't access the filesystem. It assumes no symlinks.
|
1073
|
+
#
|
1074
|
+
# ArgumentError is raised when it cannot find a relative path.
|
1075
|
+
#
|
1076
|
+
# Note that this method does not handle situations where the case sensitivity of
|
1077
|
+
# the filesystem in use differs from the operating system default.
|
1078
|
+
#
|
1079
|
+
def relative_path_from: (Pathname | string base_directory) -> Pathname
|
1080
|
+
|
1081
|
+
# <!--
|
1082
|
+
# rdoc-file=ext/pathname/pathname.c
|
1083
|
+
# - rename(p1)
|
1084
|
+
# -->
|
1085
|
+
# Rename the file.
|
1086
|
+
#
|
1087
|
+
# See File.rename.
|
1088
|
+
#
|
1089
|
+
def rename: (Pathname | string new_name) -> 0
|
1090
|
+
|
1091
|
+
# <!--
|
1092
|
+
# rdoc-file=ext/pathname/pathname.c
|
1093
|
+
# - rmdir()
|
1094
|
+
# -->
|
1095
|
+
# Remove the referenced directory.
|
1096
|
+
#
|
1097
|
+
# See Dir.rmdir.
|
1098
|
+
#
|
1099
|
+
def rmdir: () -> 0
|
1100
|
+
|
1101
|
+
# <!--
|
1102
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
1103
|
+
# - rmtree(noop: nil, verbose: nil, secure: nil)
|
1104
|
+
# -->
|
1105
|
+
# Recursively deletes a directory, including all directories beneath it.
|
1106
|
+
#
|
1107
|
+
# See FileUtils.rm_rf
|
1108
|
+
#
|
1109
|
+
def rmtree: () -> self
|
1110
|
+
|
1111
|
+
# <!--
|
1112
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
1113
|
+
# - root?()
|
1114
|
+
# -->
|
1115
|
+
# Predicate method for root directories. Returns `true` if the pathname
|
1116
|
+
# consists of consecutive slashes.
|
1117
|
+
#
|
1118
|
+
# It doesn't access the filesystem. So it may return `false` for some pathnames
|
1119
|
+
# which points to roots such as `/usr/..`.
|
1120
|
+
#
|
1121
|
+
def root?: () -> bool
|
1122
|
+
|
1123
|
+
# <!--
|
1124
|
+
# rdoc-file=ext/pathname/pathname.c
|
1125
|
+
# - setgid?()
|
1126
|
+
# -->
|
1127
|
+
# See FileTest.setgid?.
|
1128
|
+
#
|
1129
|
+
def setgid?: () -> bool
|
1130
|
+
|
1131
|
+
# <!--
|
1132
|
+
# rdoc-file=ext/pathname/pathname.c
|
1133
|
+
# - setuid?()
|
1134
|
+
# -->
|
1135
|
+
# See FileTest.setuid?.
|
1136
|
+
#
|
1137
|
+
def setuid?: () -> bool
|
1138
|
+
|
1139
|
+
# <!--
|
1140
|
+
# rdoc-file=ext/pathname/pathname.c
|
1141
|
+
# - size()
|
1142
|
+
# -->
|
1143
|
+
# See FileTest.size.
|
1144
|
+
#
|
1145
|
+
def size: () -> Integer
|
1146
|
+
|
1147
|
+
# <!--
|
1148
|
+
# rdoc-file=ext/pathname/pathname.c
|
1149
|
+
# - size?()
|
1150
|
+
# -->
|
1151
|
+
# See FileTest.size?.
|
1152
|
+
#
|
1153
|
+
def size?: () -> Integer?
|
1154
|
+
|
1155
|
+
# <!--
|
1156
|
+
# rdoc-file=ext/pathname/pathname.c
|
1157
|
+
# - socket?()
|
1158
|
+
# -->
|
1159
|
+
# See FileTest.socket?.
|
1160
|
+
#
|
1161
|
+
def socket?: () -> untyped
|
1162
|
+
|
1163
|
+
# <!--
|
1164
|
+
# rdoc-file=ext/pathname/pathname.c
|
1165
|
+
# - split()
|
1166
|
+
# -->
|
1167
|
+
# Returns the #dirname and the #basename in an Array.
|
1168
|
+
#
|
1169
|
+
# See File.split.
|
1170
|
+
#
|
1171
|
+
def split: () -> [ Pathname, Pathname ]
|
1172
|
+
|
1173
|
+
# <!--
|
1174
|
+
# rdoc-file=ext/pathname/pathname.c
|
1175
|
+
# - stat()
|
1176
|
+
# -->
|
1177
|
+
# Returns a File::Stat object.
|
1178
|
+
#
|
1179
|
+
# See File.stat.
|
1180
|
+
#
|
1181
|
+
def stat: () -> File::Stat
|
1182
|
+
|
1183
|
+
# <!--
|
1184
|
+
# rdoc-file=ext/pathname/pathname.c
|
1185
|
+
# - sticky?()
|
1186
|
+
# -->
|
1187
|
+
# See FileTest.sticky?.
|
1188
|
+
#
|
1189
|
+
def sticky?: () -> untyped
|
1190
|
+
|
1191
|
+
# <!--
|
1192
|
+
# rdoc-file=ext/pathname/pathname.c
|
1193
|
+
# - sub(*args)
|
1194
|
+
# -->
|
1195
|
+
# Return a pathname which is substituted by String#sub.
|
1196
|
+
#
|
1197
|
+
# path1 = Pathname.new('/usr/bin/perl')
|
1198
|
+
# path1.sub('perl', 'ruby')
|
1199
|
+
# #=> #<Pathname:/usr/bin/ruby>
|
1200
|
+
#
|
1201
|
+
def sub: (Regexp | string pattern, string | Hash[String, String] replacement) -> Pathname
|
1202
|
+
| (Regexp | string pattern) { (String match) -> string } -> Pathname
|
1203
|
+
|
1204
|
+
# <!--
|
1205
|
+
# rdoc-file=ext/pathname/pathname.c
|
1206
|
+
# - sub_ext(p1)
|
1207
|
+
# -->
|
1208
|
+
# Return a pathname with `repl` added as a suffix to the basename.
|
1209
|
+
#
|
1210
|
+
# If self has no extension part, `repl` is appended.
|
1211
|
+
#
|
1212
|
+
# Pathname.new('/usr/bin/shutdown').sub_ext('.rb')
|
1213
|
+
# #=> #<Pathname:/usr/bin/shutdown.rb>
|
1214
|
+
#
|
1215
|
+
def sub_ext: (string replacement) -> Pathname
|
1216
|
+
|
1217
|
+
# <!--
|
1218
|
+
# rdoc-file=ext/pathname/pathname.c
|
1219
|
+
# - symlink?()
|
1220
|
+
# -->
|
1221
|
+
# See FileTest.symlink?.
|
1222
|
+
#
|
1223
|
+
def symlink?: () -> untyped
|
1224
|
+
|
1225
|
+
# <!--
|
1226
|
+
# rdoc-file=ext/pathname/pathname.c
|
1227
|
+
# - pathname.sysopen([mode, [perm]]) -> fixnum
|
1228
|
+
# -->
|
1229
|
+
# See IO.sysopen.
|
1230
|
+
#
|
1231
|
+
def sysopen: (?String mode, ?Integer perm) -> Integer
|
1232
|
+
|
1233
|
+
# <!--
|
1234
|
+
# rdoc-file=ext/pathname/pathname.c
|
1235
|
+
# - pathname.taint -> obj
|
1236
|
+
# -->
|
1237
|
+
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
1238
|
+
#
|
1239
|
+
def taint: () -> Pathname
|
1240
|
+
|
1241
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
1242
|
+
# Return the path as a String.
|
1243
|
+
#
|
1244
|
+
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
1245
|
+
#
|
1246
|
+
def to_path: () -> String
|
1247
|
+
|
1248
|
+
# <!--
|
1249
|
+
# rdoc-file=ext/pathname/pathname.c
|
1250
|
+
# - pathname.to_s -> string
|
1251
|
+
# - pathname.to_path -> string
|
1252
|
+
# -->
|
1253
|
+
# Return the path as a String.
|
1254
|
+
#
|
1255
|
+
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
1256
|
+
#
|
1257
|
+
alias to_s to_path
|
1258
|
+
|
1259
|
+
# <!--
|
1260
|
+
# rdoc-file=ext/pathname/pathname.c
|
1261
|
+
# - truncate(p1)
|
1262
|
+
# -->
|
1263
|
+
# Truncates the file to `length` bytes.
|
1264
|
+
#
|
1265
|
+
# See File.truncate.
|
1266
|
+
#
|
1267
|
+
def truncate: (Integer length) -> 0
|
1268
|
+
|
1269
|
+
# <!--
|
1270
|
+
# rdoc-file=ext/pathname/pathname.c
|
1271
|
+
# - unlink()
|
1272
|
+
# -->
|
1273
|
+
# Removes a file or directory, using File.unlink if `self` is a file, or
|
1274
|
+
# Dir.unlink as necessary.
|
1275
|
+
#
|
1276
|
+
def unlink: () -> Integer
|
1277
|
+
|
1278
|
+
# <!--
|
1279
|
+
# rdoc-file=ext/pathname/pathname.c
|
1280
|
+
# - pathname.untaint -> obj
|
1281
|
+
# -->
|
1282
|
+
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
1283
|
+
#
|
1284
|
+
def untaint: () -> Pathname
|
1285
|
+
|
1286
|
+
# <!--
|
1287
|
+
# rdoc-file=ext/pathname/pathname.c
|
1288
|
+
# - utime(p1, p2)
|
1289
|
+
# -->
|
1290
|
+
# Update the access and modification times of the file.
|
1291
|
+
#
|
1292
|
+
# See File.utime.
|
1293
|
+
#
|
1294
|
+
def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
|
1295
|
+
|
1296
|
+
# <!--
|
1297
|
+
# rdoc-file=ext/pathname/pathname.c
|
1298
|
+
# - world_readable?()
|
1299
|
+
# -->
|
1300
|
+
# See FileTest.world_readable?.
|
1301
|
+
#
|
1302
|
+
def world_readable?: () -> (Integer | nil)
|
1303
|
+
|
1304
|
+
# <!--
|
1305
|
+
# rdoc-file=ext/pathname/pathname.c
|
1306
|
+
# - world_writable?()
|
1307
|
+
# -->
|
1308
|
+
# See FileTest.world_writable?.
|
1309
|
+
#
|
1310
|
+
def world_writable?: () -> (Integer | nil)
|
1311
|
+
|
1312
|
+
# <!--
|
1313
|
+
# rdoc-file=ext/pathname/pathname.c
|
1314
|
+
# - writable?()
|
1315
|
+
# -->
|
1316
|
+
# See FileTest.writable?.
|
1317
|
+
#
|
1318
|
+
def writable?: () -> bool
|
1319
|
+
|
1320
|
+
# <!--
|
1321
|
+
# rdoc-file=ext/pathname/pathname.c
|
1322
|
+
# - writable_real?()
|
1323
|
+
# -->
|
1324
|
+
# See FileTest.writable_real?.
|
1325
|
+
#
|
1326
|
+
def writable_real?: () -> bool
|
1327
|
+
|
1328
|
+
# <!--
|
1329
|
+
# rdoc-file=ext/pathname/pathname.c
|
1330
|
+
# - pathname.write(string, [offset] ) => fixnum
|
1331
|
+
# - pathname.write(string, [offset], open_args ) => fixnum
|
1332
|
+
# -->
|
1333
|
+
# Writes `contents` to the file.
|
1334
|
+
#
|
1335
|
+
# See File.write.
|
1336
|
+
#
|
1337
|
+
def write: (String content, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> Integer
|
1338
|
+
|
1339
|
+
# <!--
|
1340
|
+
# rdoc-file=ext/pathname/pathname.c
|
1341
|
+
# - zero?()
|
1342
|
+
# -->
|
1343
|
+
# See FileTest.zero?.
|
1344
|
+
#
|
1345
|
+
def zero?: () -> bool
|
1346
|
+
|
1347
|
+
private
|
1348
|
+
|
1349
|
+
def add_trailing_separator: (untyped path) -> untyped
|
1350
|
+
|
1351
|
+
def chop_basename: (untyped path) -> untyped
|
1352
|
+
|
1353
|
+
def cleanpath_aggressive: () -> untyped
|
1354
|
+
|
1355
|
+
def cleanpath_conservative: () -> untyped
|
1356
|
+
|
1357
|
+
def del_trailing_separator: (untyped path) -> untyped
|
1358
|
+
|
1359
|
+
def has_trailing_separator?: (untyped path) -> untyped
|
1360
|
+
|
1361
|
+
# <!--
|
1362
|
+
# rdoc-file=ext/pathname/pathname.c
|
1363
|
+
# - new(p1)
|
1364
|
+
# -->
|
1365
|
+
# Create a Pathname object from the given String (or String-like object). If
|
1366
|
+
# `path` contains a NULL character (`\0`), an ArgumentError is raised.
|
1367
|
+
#
|
1368
|
+
def initialize: (string | Pathname) -> void
|
1369
|
+
|
1370
|
+
def plus: (untyped path1, untyped path2) -> untyped
|
1371
|
+
|
1372
|
+
def prepend_prefix: (untyped prefix, untyped relpath) -> untyped
|
1373
|
+
|
1374
|
+
def split_names: (untyped path) -> untyped
|
1375
|
+
|
1376
|
+
SAME_PATHS: Proc
|
1377
|
+
|
1378
|
+
SEPARATOR_LIST: String
|
1379
|
+
|
1380
|
+
SEPARATOR_PAT: Regexp
|
1381
|
+
|
1382
|
+
TO_PATH: Symbol
|
1383
|
+
end
|
1384
|
+
|
1385
|
+
%a{annotate:rdoc:skip}
|
1386
|
+
module Kernel
|
1387
|
+
private
|
1388
|
+
|
1389
|
+
# <!--
|
1390
|
+
# rdoc-file=ext/pathname/pathname.c
|
1391
|
+
# - Pathname(path) -> pathname
|
1392
|
+
# -->
|
1393
|
+
# Creates a new Pathname object from the given string, `path`, and returns
|
1394
|
+
# pathname object.
|
1395
|
+
#
|
1396
|
+
# In order to use this constructor, you must first require the Pathname standard
|
1397
|
+
# library extension.
|
1398
|
+
#
|
1399
|
+
# require 'pathname'
|
1400
|
+
# Pathname("/home/zzak")
|
1401
|
+
# #=> #<Pathname:/home/zzak>
|
1402
|
+
#
|
1403
|
+
# See also Pathname::new for more information.
|
1404
|
+
#
|
1405
|
+
def self?.Pathname: (string | Pathname) -> Pathname
|
1406
|
+
end
|