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.
Files changed (484) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +22 -0
  3. data/.github/workflows/comments.yml +35 -0
  4. data/.github/workflows/dependabot.yml +30 -0
  5. data/.github/workflows/ruby.yml +82 -0
  6. data/.github/workflows/typecheck.yml +38 -0
  7. data/.github/workflows/windows.yml +43 -0
  8. data/.gitignore +23 -0
  9. data/.rubocop.yml +68 -0
  10. data/BSDL +22 -0
  11. data/CHANGELOG.md +1868 -0
  12. data/COPYING +56 -0
  13. data/README.md +203 -0
  14. data/Rakefile +417 -0
  15. data/Steepfile +44 -0
  16. data/config.yml +313 -0
  17. data/core/array.rbs +4062 -0
  18. data/core/basic_object.rbs +375 -0
  19. data/core/binding.rbs +150 -0
  20. data/core/builtin.rbs +277 -0
  21. data/core/class.rbs +220 -0
  22. data/core/comparable.rbs +171 -0
  23. data/core/complex.rbs +786 -0
  24. data/core/constants.rbs +96 -0
  25. data/core/data.rbs +415 -0
  26. data/core/dir.rbs +981 -0
  27. data/core/encoding.rbs +1371 -0
  28. data/core/enumerable.rbs +2405 -0
  29. data/core/enumerator/product.rbs +92 -0
  30. data/core/enumerator.rbs +630 -0
  31. data/core/env.rbs +6 -0
  32. data/core/errno.rbs +673 -0
  33. data/core/errors.rbs +760 -0
  34. data/core/exception.rbs +485 -0
  35. data/core/false_class.rbs +82 -0
  36. data/core/fiber.rbs +550 -0
  37. data/core/fiber_error.rbs +11 -0
  38. data/core/file.rbs +2936 -0
  39. data/core/file_test.rbs +331 -0
  40. data/core/float.rbs +1151 -0
  41. data/core/gc.rbs +644 -0
  42. data/core/global_variables.rbs +184 -0
  43. data/core/hash.rbs +1861 -0
  44. data/core/integer.rbs +1413 -0
  45. data/core/io/buffer.rbs +984 -0
  46. data/core/io/wait.rbs +70 -0
  47. data/core/io.rbs +3406 -0
  48. data/core/kernel.rbs +3096 -0
  49. data/core/marshal.rbs +207 -0
  50. data/core/match_data.rbs +635 -0
  51. data/core/math.rbs +729 -0
  52. data/core/method.rbs +386 -0
  53. data/core/module.rbs +1704 -0
  54. data/core/nil_class.rbs +209 -0
  55. data/core/numeric.rbs +818 -0
  56. data/core/object.rbs +110 -0
  57. data/core/object_space/weak_key_map.rbs +166 -0
  58. data/core/object_space.rbs +190 -0
  59. data/core/proc.rbs +868 -0
  60. data/core/process.rbs +2296 -0
  61. data/core/ractor.rbs +1068 -0
  62. data/core/random.rbs +237 -0
  63. data/core/range.rbs +1107 -0
  64. data/core/rational.rbs +531 -0
  65. data/core/rb_config.rbs +88 -0
  66. data/core/rbs/unnamed/argf.rbs +1229 -0
  67. data/core/rbs/unnamed/env_class.rbs +1209 -0
  68. data/core/rbs/unnamed/random.rbs +293 -0
  69. data/core/refinement.rbs +59 -0
  70. data/core/regexp.rbs +1930 -0
  71. data/core/ruby_vm.rbs +765 -0
  72. data/core/rubygems/basic_specification.rbs +6 -0
  73. data/core/rubygems/config_file.rbs +38 -0
  74. data/core/rubygems/dependency_installer.rbs +6 -0
  75. data/core/rubygems/errors.rbs +176 -0
  76. data/core/rubygems/installer.rbs +15 -0
  77. data/core/rubygems/path_support.rbs +6 -0
  78. data/core/rubygems/platform.rbs +7 -0
  79. data/core/rubygems/request_set.rbs +49 -0
  80. data/core/rubygems/requirement.rbs +148 -0
  81. data/core/rubygems/rubygems.rbs +1171 -0
  82. data/core/rubygems/source_list.rbs +15 -0
  83. data/core/rubygems/specification.rbs +23 -0
  84. data/core/rubygems/stream_ui.rbs +5 -0
  85. data/core/rubygems/uninstaller.rbs +10 -0
  86. data/core/rubygems/version.rbs +294 -0
  87. data/core/set.rbs +621 -0
  88. data/core/signal.rbs +100 -0
  89. data/core/string.rbs +3583 -0
  90. data/core/struct.rbs +667 -0
  91. data/core/symbol.rbs +475 -0
  92. data/core/thread.rbs +1765 -0
  93. data/core/thread_group.rbs +79 -0
  94. data/core/time.rbs +1762 -0
  95. data/core/trace_point.rbs +477 -0
  96. data/core/true_class.rbs +98 -0
  97. data/core/unbound_method.rbs +329 -0
  98. data/core/warning.rbs +87 -0
  99. data/docs/CONTRIBUTING.md +106 -0
  100. data/docs/architecture.md +110 -0
  101. data/docs/collection.md +192 -0
  102. data/docs/data_and_struct.md +86 -0
  103. data/docs/gem.md +57 -0
  104. data/docs/rbs_by_example.md +309 -0
  105. data/docs/repo.md +125 -0
  106. data/docs/sigs.md +167 -0
  107. data/docs/stdlib.md +147 -0
  108. data/docs/syntax.md +910 -0
  109. data/docs/tools.md +17 -0
  110. data/exe/rbs +7 -0
  111. data/ext/rbs_extension/extconf.rb +15 -0
  112. data/ext/rbs_extension/lexer.c +2728 -0
  113. data/ext/rbs_extension/lexer.h +179 -0
  114. data/ext/rbs_extension/lexer.re +147 -0
  115. data/ext/rbs_extension/lexstate.c +175 -0
  116. data/ext/rbs_extension/location.c +325 -0
  117. data/ext/rbs_extension/location.h +85 -0
  118. data/ext/rbs_extension/main.c +33 -0
  119. data/ext/rbs_extension/parser.c +2973 -0
  120. data/ext/rbs_extension/parser.h +18 -0
  121. data/ext/rbs_extension/parserstate.c +397 -0
  122. data/ext/rbs_extension/parserstate.h +163 -0
  123. data/ext/rbs_extension/rbs_extension.h +31 -0
  124. data/ext/rbs_extension/unescape.c +32 -0
  125. data/goodcheck.yml +91 -0
  126. data/include/rbs/constants.h +82 -0
  127. data/include/rbs/ruby_objs.h +72 -0
  128. data/include/rbs/util/rbs_constant_pool.h +219 -0
  129. data/include/rbs.h +7 -0
  130. data/lib/rbs/ancestor_graph.rb +92 -0
  131. data/lib/rbs/annotate/annotations.rb +199 -0
  132. data/lib/rbs/annotate/formatter.rb +92 -0
  133. data/lib/rbs/annotate/rdoc_annotator.rb +400 -0
  134. data/lib/rbs/annotate/rdoc_source.rb +131 -0
  135. data/lib/rbs/annotate.rb +8 -0
  136. data/lib/rbs/ast/annotation.rb +29 -0
  137. data/lib/rbs/ast/comment.rb +29 -0
  138. data/lib/rbs/ast/declarations.rb +467 -0
  139. data/lib/rbs/ast/directives.rb +49 -0
  140. data/lib/rbs/ast/members.rb +451 -0
  141. data/lib/rbs/ast/type_param.rb +225 -0
  142. data/lib/rbs/ast/visitor.rb +137 -0
  143. data/lib/rbs/buffer.rb +67 -0
  144. data/lib/rbs/builtin_names.rb +58 -0
  145. data/lib/rbs/cli/colored_io.rb +48 -0
  146. data/lib/rbs/cli/diff.rb +83 -0
  147. data/lib/rbs/cli/validate.rb +357 -0
  148. data/lib/rbs/cli.rb +1223 -0
  149. data/lib/rbs/collection/cleaner.rb +38 -0
  150. data/lib/rbs/collection/config/lockfile.rb +92 -0
  151. data/lib/rbs/collection/config/lockfile_generator.rb +218 -0
  152. data/lib/rbs/collection/config.rb +81 -0
  153. data/lib/rbs/collection/installer.rb +32 -0
  154. data/lib/rbs/collection/sources/base.rb +14 -0
  155. data/lib/rbs/collection/sources/git.rb +258 -0
  156. data/lib/rbs/collection/sources/local.rb +81 -0
  157. data/lib/rbs/collection/sources/rubygems.rb +48 -0
  158. data/lib/rbs/collection/sources/stdlib.rb +50 -0
  159. data/lib/rbs/collection/sources.rb +38 -0
  160. data/lib/rbs/collection.rb +16 -0
  161. data/lib/rbs/constant.rb +28 -0
  162. data/lib/rbs/definition.rb +401 -0
  163. data/lib/rbs/definition_builder/ancestor_builder.rb +620 -0
  164. data/lib/rbs/definition_builder/method_builder.rb +254 -0
  165. data/lib/rbs/definition_builder.rb +845 -0
  166. data/lib/rbs/diff.rb +125 -0
  167. data/lib/rbs/environment/use_map.rb +77 -0
  168. data/lib/rbs/environment.rb +829 -0
  169. data/lib/rbs/environment_loader.rb +173 -0
  170. data/lib/rbs/environment_walker.rb +155 -0
  171. data/lib/rbs/errors.rb +645 -0
  172. data/lib/rbs/factory.rb +18 -0
  173. data/lib/rbs/file_finder.rb +28 -0
  174. data/lib/rbs/location_aux.rb +138 -0
  175. data/lib/rbs/locator.rb +243 -0
  176. data/lib/rbs/method_type.rb +143 -0
  177. data/lib/rbs/namespace.rb +125 -0
  178. data/lib/rbs/parser/lex_result.rb +15 -0
  179. data/lib/rbs/parser/token.rb +23 -0
  180. data/lib/rbs/parser_aux.rb +114 -0
  181. data/lib/rbs/prototype/helpers.rb +140 -0
  182. data/lib/rbs/prototype/node_usage.rb +99 -0
  183. data/lib/rbs/prototype/rb.rb +840 -0
  184. data/lib/rbs/prototype/rbi.rb +641 -0
  185. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  186. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  187. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  188. data/lib/rbs/prototype/runtime.rb +667 -0
  189. data/lib/rbs/repository.rb +127 -0
  190. data/lib/rbs/resolver/constant_resolver.rb +219 -0
  191. data/lib/rbs/resolver/type_name_resolver.rb +91 -0
  192. data/lib/rbs/sorter.rb +198 -0
  193. data/lib/rbs/substitution.rb +83 -0
  194. data/lib/rbs/subtractor.rb +201 -0
  195. data/lib/rbs/test/errors.rb +80 -0
  196. data/lib/rbs/test/guaranteed.rb +30 -0
  197. data/lib/rbs/test/hook.rb +212 -0
  198. data/lib/rbs/test/observer.rb +19 -0
  199. data/lib/rbs/test/setup.rb +84 -0
  200. data/lib/rbs/test/setup_helper.rb +50 -0
  201. data/lib/rbs/test/tester.rb +167 -0
  202. data/lib/rbs/test/type_check.rb +435 -0
  203. data/lib/rbs/test.rb +112 -0
  204. data/lib/rbs/type_alias_dependency.rb +100 -0
  205. data/lib/rbs/type_alias_regularity.rb +126 -0
  206. data/lib/rbs/type_name.rb +109 -0
  207. data/lib/rbs/types.rb +1596 -0
  208. data/lib/rbs/unit_test/convertibles.rb +176 -0
  209. data/lib/rbs/unit_test/spy.rb +138 -0
  210. data/lib/rbs/unit_test/type_assertions.rb +347 -0
  211. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  212. data/lib/rbs/unit_test.rb +6 -0
  213. data/lib/rbs/validator.rb +186 -0
  214. data/lib/rbs/variance_calculator.rb +189 -0
  215. data/lib/rbs/vendorer.rb +71 -0
  216. data/lib/rbs/version.rb +5 -0
  217. data/lib/rbs/writer.rb +424 -0
  218. data/lib/rbs.rb +94 -0
  219. data/lib/rdoc/discover.rb +20 -0
  220. data/lib/rdoc_plugin/parser.rb +163 -0
  221. data/rbs-relaxed.gemspec +48 -0
  222. data/schema/annotation.json +14 -0
  223. data/schema/comment.json +26 -0
  224. data/schema/decls.json +326 -0
  225. data/schema/function.json +87 -0
  226. data/schema/location.json +56 -0
  227. data/schema/members.json +266 -0
  228. data/schema/methodType.json +50 -0
  229. data/schema/typeParam.json +36 -0
  230. data/schema/types.json +317 -0
  231. data/sig/ancestor_builder.rbs +163 -0
  232. data/sig/ancestor_graph.rbs +60 -0
  233. data/sig/annotate/annotations.rbs +102 -0
  234. data/sig/annotate/formatter.rbs +24 -0
  235. data/sig/annotate/rdoc_annotater.rbs +82 -0
  236. data/sig/annotate/rdoc_source.rbs +30 -0
  237. data/sig/annotation.rbs +27 -0
  238. data/sig/buffer.rbs +32 -0
  239. data/sig/builtin_names.rbs +44 -0
  240. data/sig/cli/colored_io.rbs +15 -0
  241. data/sig/cli/diff.rbs +21 -0
  242. data/sig/cli/validate.rbs +43 -0
  243. data/sig/cli.rbs +87 -0
  244. data/sig/collection/cleaner.rbs +13 -0
  245. data/sig/collection/config/lockfile.rbs +74 -0
  246. data/sig/collection/config/lockfile_generator.rbs +66 -0
  247. data/sig/collection/config.rbs +46 -0
  248. data/sig/collection/installer.rbs +17 -0
  249. data/sig/collection/sources.rbs +214 -0
  250. data/sig/collection.rbs +4 -0
  251. data/sig/comment.rbs +26 -0
  252. data/sig/constant.rbs +21 -0
  253. data/sig/declarations.rbs +267 -0
  254. data/sig/definition.rbs +173 -0
  255. data/sig/definition_builder.rbs +165 -0
  256. data/sig/diff.rbs +28 -0
  257. data/sig/directives.rbs +77 -0
  258. data/sig/environment.rbs +279 -0
  259. data/sig/environment_loader.rbs +111 -0
  260. data/sig/environment_walker.rbs +65 -0
  261. data/sig/errors.rbs +405 -0
  262. data/sig/factory.rbs +5 -0
  263. data/sig/file_finder.rbs +28 -0
  264. data/sig/location.rbs +110 -0
  265. data/sig/locator.rbs +58 -0
  266. data/sig/manifest.yaml +7 -0
  267. data/sig/members.rbs +258 -0
  268. data/sig/method_builder.rbs +84 -0
  269. data/sig/method_types.rbs +58 -0
  270. data/sig/namespace.rbs +146 -0
  271. data/sig/parser.rbs +100 -0
  272. data/sig/prototype/helpers.rbs +27 -0
  273. data/sig/prototype/node_usage.rbs +20 -0
  274. data/sig/prototype/rb.rbs +96 -0
  275. data/sig/prototype/rbi.rbs +75 -0
  276. data/sig/prototype/runtime.rbs +182 -0
  277. data/sig/rbs.rbs +21 -0
  278. data/sig/rdoc/rbs.rbs +67 -0
  279. data/sig/repository.rbs +85 -0
  280. data/sig/resolver/constant_resolver.rbs +92 -0
  281. data/sig/resolver/context.rbs +34 -0
  282. data/sig/resolver/type_name_resolver.rbs +35 -0
  283. data/sig/shims/bundler.rbs +38 -0
  284. data/sig/shims/enumerable.rbs +5 -0
  285. data/sig/shims/rubygems.rbs +19 -0
  286. data/sig/sorter.rbs +41 -0
  287. data/sig/substitution.rbs +48 -0
  288. data/sig/subtractor.rbs +37 -0
  289. data/sig/test/errors.rbs +52 -0
  290. data/sig/test/guranteed.rbs +9 -0
  291. data/sig/test/type_check.rbs +19 -0
  292. data/sig/test.rbs +82 -0
  293. data/sig/type_alias_dependency.rbs +53 -0
  294. data/sig/type_alias_regularity.rbs +98 -0
  295. data/sig/type_param.rbs +110 -0
  296. data/sig/typename.rbs +79 -0
  297. data/sig/types.rbs +579 -0
  298. data/sig/unit_test/convertibles.rbs +154 -0
  299. data/sig/unit_test/spy.rbs +30 -0
  300. data/sig/unit_test/type_assertions.rbs +196 -0
  301. data/sig/unit_test/with_aliases.rbs +136 -0
  302. data/sig/use_map.rbs +35 -0
  303. data/sig/util.rbs +9 -0
  304. data/sig/validator.rbs +63 -0
  305. data/sig/variance_calculator.rbs +87 -0
  306. data/sig/vendorer.rbs +51 -0
  307. data/sig/version.rbs +3 -0
  308. data/sig/visitor.rbs +47 -0
  309. data/sig/writer.rbs +127 -0
  310. data/src/constants.c +153 -0
  311. data/src/ruby_objs.c +795 -0
  312. data/src/util/rbs_constant_pool.c +342 -0
  313. data/stdlib/abbrev/0/abbrev.rbs +66 -0
  314. data/stdlib/abbrev/0/array.rbs +26 -0
  315. data/stdlib/base64/0/base64.rbs +355 -0
  316. data/stdlib/benchmark/0/benchmark.rbs +452 -0
  317. data/stdlib/bigdecimal/0/big_decimal.rbs +1629 -0
  318. data/stdlib/bigdecimal-math/0/big_math.rbs +119 -0
  319. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  320. data/stdlib/cgi/0/core.rbs +1285 -0
  321. data/stdlib/cgi/0/manifest.yaml +3 -0
  322. data/stdlib/coverage/0/coverage.rbs +263 -0
  323. data/stdlib/csv/0/csv.rbs +3776 -0
  324. data/stdlib/csv/0/manifest.yaml +3 -0
  325. data/stdlib/date/0/date.rbs +1585 -0
  326. data/stdlib/date/0/date_time.rbs +616 -0
  327. data/stdlib/date/0/time.rbs +26 -0
  328. data/stdlib/dbm/0/dbm.rbs +421 -0
  329. data/stdlib/delegate/0/delegator.rbs +184 -0
  330. data/stdlib/delegate/0/kernel.rbs +47 -0
  331. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  332. data/stdlib/did_you_mean/0/did_you_mean.rbs +343 -0
  333. data/stdlib/digest/0/digest.rbs +577 -0
  334. data/stdlib/erb/0/erb.rbs +532 -0
  335. data/stdlib/etc/0/etc.rbs +865 -0
  336. data/stdlib/fileutils/0/fileutils.rbs +1734 -0
  337. data/stdlib/find/0/find.rbs +49 -0
  338. data/stdlib/forwardable/0/forwardable.rbs +268 -0
  339. data/stdlib/io-console/0/io-console.rbs +414 -0
  340. data/stdlib/ipaddr/0/ipaddr.rbs +428 -0
  341. data/stdlib/json/0/json.rbs +1916 -0
  342. data/stdlib/kconv/0/kconv.rbs +166 -0
  343. data/stdlib/logger/0/formatter.rbs +45 -0
  344. data/stdlib/logger/0/log_device.rbs +100 -0
  345. data/stdlib/logger/0/logger.rbs +796 -0
  346. data/stdlib/logger/0/manifest.yaml +2 -0
  347. data/stdlib/logger/0/period.rbs +17 -0
  348. data/stdlib/logger/0/severity.rbs +34 -0
  349. data/stdlib/minitest/0/kernel.rbs +42 -0
  350. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
  351. data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
  352. data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
  353. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
  354. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  355. data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
  356. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  357. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  358. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  359. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  360. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  361. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  362. data/stdlib/minitest/0/minitest/mock.rbs +64 -0
  363. data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
  364. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
  365. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  366. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  367. data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
  368. data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
  369. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  370. data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
  371. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  372. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  373. data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
  374. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  375. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  376. data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
  377. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  378. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
  379. data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
  380. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  381. data/stdlib/minitest/0/minitest/test.rbs +69 -0
  382. data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
  383. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  384. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  385. data/stdlib/minitest/0/minitest/unit.rbs +4 -0
  386. data/stdlib/minitest/0/minitest.rbs +115 -0
  387. data/stdlib/monitor/0/monitor.rbs +363 -0
  388. data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
  389. data/stdlib/net-http/0/manifest.yaml +3 -0
  390. data/stdlib/net-http/0/net-http.rbs +5552 -0
  391. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  392. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  393. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  394. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  395. data/stdlib/nkf/0/nkf.rbs +402 -0
  396. data/stdlib/objspace/0/objspace.rbs +487 -0
  397. data/stdlib/observable/0/observable.rbs +217 -0
  398. data/stdlib/open-uri/0/manifest.yaml +4 -0
  399. data/stdlib/open-uri/0/open-uri.rbs +393 -0
  400. data/stdlib/open3/0/open3.rbs +147 -0
  401. data/stdlib/openssl/0/manifest.yaml +3 -0
  402. data/stdlib/openssl/0/openssl.rbs +12113 -0
  403. data/stdlib/optparse/0/optparse.rbs +1725 -0
  404. data/stdlib/pathname/0/pathname.rbs +1406 -0
  405. data/stdlib/pp/0/manifest.yaml +2 -0
  406. data/stdlib/pp/0/pp.rbs +300 -0
  407. data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
  408. data/stdlib/pstore/0/pstore.rbs +603 -0
  409. data/stdlib/psych/0/core_ext.rbs +12 -0
  410. data/stdlib/psych/0/dbm.rbs +237 -0
  411. data/stdlib/psych/0/manifest.yaml +3 -0
  412. data/stdlib/psych/0/psych.rbs +402 -0
  413. data/stdlib/psych/0/store.rbs +59 -0
  414. data/stdlib/pty/0/pty.rbs +237 -0
  415. data/stdlib/rdoc/0/code_object.rbs +51 -0
  416. data/stdlib/rdoc/0/comment.rbs +59 -0
  417. data/stdlib/rdoc/0/context.rbs +153 -0
  418. data/stdlib/rdoc/0/markup.rbs +117 -0
  419. data/stdlib/rdoc/0/parser.rbs +56 -0
  420. data/stdlib/rdoc/0/rdoc.rbs +391 -0
  421. data/stdlib/rdoc/0/ri.rbs +17 -0
  422. data/stdlib/rdoc/0/store.rbs +48 -0
  423. data/stdlib/rdoc/0/top_level.rbs +97 -0
  424. data/stdlib/resolv/0/manifest.yaml +3 -0
  425. data/stdlib/resolv/0/resolv.rbs +1830 -0
  426. data/stdlib/ripper/0/ripper.rbs +1648 -0
  427. data/stdlib/securerandom/0/securerandom.rbs +62 -0
  428. data/stdlib/shellwords/0/shellwords.rbs +229 -0
  429. data/stdlib/singleton/0/singleton.rbs +131 -0
  430. data/stdlib/socket/0/addrinfo.rbs +666 -0
  431. data/stdlib/socket/0/basic_socket.rbs +590 -0
  432. data/stdlib/socket/0/constants.rbs +2295 -0
  433. data/stdlib/socket/0/ip_socket.rbs +92 -0
  434. data/stdlib/socket/0/socket.rbs +4157 -0
  435. data/stdlib/socket/0/socket_error.rbs +5 -0
  436. data/stdlib/socket/0/tcp_server.rbs +192 -0
  437. data/stdlib/socket/0/tcp_socket.rbs +79 -0
  438. data/stdlib/socket/0/udp_socket.rbs +133 -0
  439. data/stdlib/socket/0/unix_server.rbs +169 -0
  440. data/stdlib/socket/0/unix_socket.rbs +172 -0
  441. data/stdlib/stringio/0/stringio.rbs +567 -0
  442. data/stdlib/strscan/0/string_scanner.rbs +1627 -0
  443. data/stdlib/tempfile/0/tempfile.rbs +479 -0
  444. data/stdlib/time/0/time.rbs +432 -0
  445. data/stdlib/timeout/0/timeout.rbs +81 -0
  446. data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
  447. data/stdlib/tsort/0/cyclic.rbs +5 -0
  448. data/stdlib/tsort/0/interfaces.rbs +20 -0
  449. data/stdlib/tsort/0/tsort.rbs +409 -0
  450. data/stdlib/uri/0/common.rbs +582 -0
  451. data/stdlib/uri/0/file.rbs +118 -0
  452. data/stdlib/uri/0/ftp.rbs +13 -0
  453. data/stdlib/uri/0/generic.rbs +1108 -0
  454. data/stdlib/uri/0/http.rbs +104 -0
  455. data/stdlib/uri/0/https.rbs +14 -0
  456. data/stdlib/uri/0/ldap.rbs +230 -0
  457. data/stdlib/uri/0/ldaps.rbs +14 -0
  458. data/stdlib/uri/0/mailto.rbs +92 -0
  459. data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
  460. data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
  461. data/stdlib/uri/0/ws.rbs +13 -0
  462. data/stdlib/uri/0/wss.rbs +9 -0
  463. data/stdlib/yaml/0/manifest.yaml +2 -0
  464. data/stdlib/yaml/0/yaml.rbs +1 -0
  465. data/stdlib/zlib/0/buf_error.rbs +10 -0
  466. data/stdlib/zlib/0/data_error.rbs +10 -0
  467. data/stdlib/zlib/0/deflate.rbs +210 -0
  468. data/stdlib/zlib/0/error.rbs +20 -0
  469. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  470. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  471. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  472. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  473. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  474. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  475. data/stdlib/zlib/0/gzip_writer.rbs +166 -0
  476. data/stdlib/zlib/0/inflate.rbs +180 -0
  477. data/stdlib/zlib/0/mem_error.rbs +10 -0
  478. data/stdlib/zlib/0/need_dict.rbs +13 -0
  479. data/stdlib/zlib/0/stream_end.rbs +11 -0
  480. data/stdlib/zlib/0/stream_error.rbs +11 -0
  481. data/stdlib/zlib/0/version_error.rbs +11 -0
  482. data/stdlib/zlib/0/zlib.rbs +449 -0
  483. data/stdlib/zlib/0/zstream.rbs +200 -0
  484. metadata +532 -0
@@ -0,0 +1,1725 @@
1
+ # <!-- rdoc-file=lib/optparse.rb -->
2
+ # ## OptionParser
3
+ #
4
+ # ### New to `OptionParser`?
5
+ #
6
+ # See the [Tutorial](optparse/tutorial.rdoc).
7
+ #
8
+ # ### Introduction
9
+ #
10
+ # OptionParser is a class for command-line option analysis. It is much more
11
+ # advanced, yet also easier to use, than GetoptLong, and is a more Ruby-oriented
12
+ # solution.
13
+ #
14
+ # ### Features
15
+ #
16
+ # 1. The argument specification and the code to handle it are written in the
17
+ # same place.
18
+ # 2. It can output an option summary; you don't need to maintain this string
19
+ # separately.
20
+ # 3. Optional and mandatory arguments are specified very gracefully.
21
+ # 4. Arguments can be automatically converted to a specified class.
22
+ # 5. Arguments can be restricted to a certain set.
23
+ #
24
+ # All of these features are demonstrated in the examples below. See
25
+ # #make_switch for full documentation.
26
+ #
27
+ # ### Minimal example
28
+ #
29
+ # require 'optparse'
30
+ #
31
+ # options = {}
32
+ # OptionParser.new do |parser|
33
+ # parser.banner = "Usage: example.rb [options]"
34
+ #
35
+ # parser.on("-v", "--[no-]verbose", "Run verbosely") do |v|
36
+ # options[:verbose] = v
37
+ # end
38
+ # end.parse!
39
+ #
40
+ # p options
41
+ # p ARGV
42
+ #
43
+ # ### Generating Help
44
+ #
45
+ # OptionParser can be used to automatically generate help for the commands you
46
+ # write:
47
+ #
48
+ # require 'optparse'
49
+ #
50
+ # Options = Struct.new(:name)
51
+ #
52
+ # class Parser
53
+ # def self.parse(options)
54
+ # args = Options.new("world")
55
+ #
56
+ # opt_parser = OptionParser.new do |parser|
57
+ # parser.banner = "Usage: example.rb [options]"
58
+ #
59
+ # parser.on("-nNAME", "--name=NAME", "Name to say hello to") do |n|
60
+ # args.name = n
61
+ # end
62
+ #
63
+ # parser.on("-h", "--help", "Prints this help") do
64
+ # puts parser
65
+ # exit
66
+ # end
67
+ # end
68
+ #
69
+ # opt_parser.parse!(options)
70
+ # return args
71
+ # end
72
+ # end
73
+ # options = Parser.parse %w[--help]
74
+ #
75
+ # #=>
76
+ # # Usage: example.rb [options]
77
+ # # -n, --name=NAME Name to say hello to
78
+ # # -h, --help Prints this help
79
+ #
80
+ # ### Required Arguments
81
+ #
82
+ # For options that require an argument, option specification strings may include
83
+ # an option name in all caps. If an option is used without the required
84
+ # argument, an exception will be raised.
85
+ #
86
+ # require 'optparse'
87
+ #
88
+ # options = {}
89
+ # OptionParser.new do |parser|
90
+ # parser.on("-r", "--require LIBRARY",
91
+ # "Require the LIBRARY before executing your script") do |lib|
92
+ # puts "You required #{lib}!"
93
+ # end
94
+ # end.parse!
95
+ #
96
+ # Used:
97
+ #
98
+ # $ ruby optparse-test.rb -r
99
+ # optparse-test.rb:9:in `<main>': missing argument: -r (OptionParser::MissingArgument)
100
+ # $ ruby optparse-test.rb -r my-library
101
+ # You required my-library!
102
+ #
103
+ # ### Type Coercion
104
+ #
105
+ # OptionParser supports the ability to coerce command line arguments into
106
+ # objects for us.
107
+ #
108
+ # OptionParser comes with a few ready-to-use kinds of type coercion. They are:
109
+ #
110
+ # * Date -- Anything accepted by `Date.parse` (need to require
111
+ # `optparse/date`)
112
+ # * DateTime -- Anything accepted by `DateTime.parse` (need to require
113
+ # `optparse/date`)
114
+ # * Time -- Anything accepted by `Time.httpdate` or `Time.parse` (need to
115
+ # require `optparse/time`)
116
+ # * URI -- Anything accepted by `URI.parse` (need to require `optparse/uri`)
117
+ # * Shellwords -- Anything accepted by `Shellwords.shellwords` (need to
118
+ # require `optparse/shellwords`)
119
+ # * String -- Any non-empty string
120
+ # * Integer -- Any integer. Will convert octal. (e.g. 124, -3, 040)
121
+ # * Float -- Any float. (e.g. 10, 3.14, -100E+13)
122
+ # * Numeric -- Any integer, float, or rational (1, 3.4, 1/3)
123
+ # * DecimalInteger -- Like `Integer`, but no octal format.
124
+ # * OctalInteger -- Like `Integer`, but no decimal format.
125
+ # * DecimalNumeric -- Decimal integer or float.
126
+ # * TrueClass -- Accepts '+, yes, true, -, no, false' and defaults as `true`
127
+ # * FalseClass -- Same as `TrueClass`, but defaults to `false`
128
+ # * Array -- Strings separated by ',' (e.g. 1,2,3)
129
+ # * Regexp -- Regular expressions. Also includes options.
130
+ #
131
+ # We can also add our own coercions, which we will cover below.
132
+ #
133
+ # #### Using Built-in Conversions
134
+ #
135
+ # As an example, the built-in `Time` conversion is used. The other built-in
136
+ # conversions behave in the same way. OptionParser will attempt to parse the
137
+ # argument as a `Time`. If it succeeds, that time will be passed to the handler
138
+ # block. Otherwise, an exception will be raised.
139
+ #
140
+ # require 'optparse'
141
+ # require 'optparse/time'
142
+ # OptionParser.new do |parser|
143
+ # parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
144
+ # p time
145
+ # end
146
+ # end.parse!
147
+ #
148
+ # Used:
149
+ #
150
+ # $ ruby optparse-test.rb -t nonsense
151
+ # ... invalid argument: -t nonsense (OptionParser::InvalidArgument)
152
+ # $ ruby optparse-test.rb -t 10-11-12
153
+ # 2010-11-12 00:00:00 -0500
154
+ # $ ruby optparse-test.rb -t 9:30
155
+ # 2014-08-13 09:30:00 -0400
156
+ #
157
+ # #### Creating Custom Conversions
158
+ #
159
+ # The `accept` method on OptionParser may be used to create converters. It
160
+ # specifies which conversion block to call whenever a class is specified. The
161
+ # example below uses it to fetch a `User` object before the `on` handler
162
+ # receives it.
163
+ #
164
+ # require 'optparse'
165
+ #
166
+ # User = Struct.new(:id, :name)
167
+ #
168
+ # def find_user id
169
+ # not_found = ->{ raise "No User Found for id #{id}" }
170
+ # [ User.new(1, "Sam"),
171
+ # User.new(2, "Gandalf") ].find(not_found) do |u|
172
+ # u.id == id
173
+ # end
174
+ # end
175
+ #
176
+ # op = OptionParser.new
177
+ # op.accept(User) do |user_id|
178
+ # find_user user_id.to_i
179
+ # end
180
+ #
181
+ # op.on("--user ID", User) do |user|
182
+ # puts user
183
+ # end
184
+ #
185
+ # op.parse!
186
+ #
187
+ # Used:
188
+ #
189
+ # $ ruby optparse-test.rb --user 1
190
+ # #<struct User id=1, name="Sam">
191
+ # $ ruby optparse-test.rb --user 2
192
+ # #<struct User id=2, name="Gandalf">
193
+ # $ ruby optparse-test.rb --user 3
194
+ # optparse-test.rb:15:in `block in find_user': No User Found for id 3 (RuntimeError)
195
+ #
196
+ # ### Store options to a Hash
197
+ #
198
+ # The `into` option of `order`, `parse` and so on methods stores command line
199
+ # options into a Hash.
200
+ #
201
+ # require 'optparse'
202
+ #
203
+ # options = {}
204
+ # OptionParser.new do |parser|
205
+ # parser.on('-a')
206
+ # parser.on('-b NUM', Integer)
207
+ # parser.on('-v', '--verbose')
208
+ # end.parse!(into: options)
209
+ #
210
+ # p options
211
+ #
212
+ # Used:
213
+ #
214
+ # $ ruby optparse-test.rb -a
215
+ # {:a=>true}
216
+ # $ ruby optparse-test.rb -a -v
217
+ # {:a=>true, :verbose=>true}
218
+ # $ ruby optparse-test.rb -a -b 100
219
+ # {:a=>true, :b=>100}
220
+ #
221
+ # ### Complete example
222
+ #
223
+ # The following example is a complete Ruby program. You can run it and see the
224
+ # effect of specifying various options. This is probably the best way to learn
225
+ # the features of `optparse`.
226
+ #
227
+ # require 'optparse'
228
+ # require 'optparse/time'
229
+ # require 'ostruct'
230
+ # require 'pp'
231
+ #
232
+ # class OptparseExample
233
+ # Version = '1.0.0'
234
+ #
235
+ # CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
236
+ # CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
237
+ #
238
+ # class ScriptOptions
239
+ # attr_accessor :library, :inplace, :encoding, :transfer_type,
240
+ # :verbose, :extension, :delay, :time, :record_separator,
241
+ # :list
242
+ #
243
+ # def initialize
244
+ # self.library = []
245
+ # self.inplace = false
246
+ # self.encoding = "utf8"
247
+ # self.transfer_type = :auto
248
+ # self.verbose = false
249
+ # end
250
+ #
251
+ # def define_options(parser)
252
+ # parser.banner = "Usage: example.rb [options]"
253
+ # parser.separator ""
254
+ # parser.separator "Specific options:"
255
+ #
256
+ # # add additional options
257
+ # perform_inplace_option(parser)
258
+ # delay_execution_option(parser)
259
+ # execute_at_time_option(parser)
260
+ # specify_record_separator_option(parser)
261
+ # list_example_option(parser)
262
+ # specify_encoding_option(parser)
263
+ # optional_option_argument_with_keyword_completion_option(parser)
264
+ # boolean_verbose_option(parser)
265
+ #
266
+ # parser.separator ""
267
+ # parser.separator "Common options:"
268
+ # # No argument, shows at tail. This will print an options summary.
269
+ # # Try it and see!
270
+ # parser.on_tail("-h", "--help", "Show this message") do
271
+ # puts parser
272
+ # exit
273
+ # end
274
+ # # Another typical switch to print the version.
275
+ # parser.on_tail("--version", "Show version") do
276
+ # puts Version
277
+ # exit
278
+ # end
279
+ # end
280
+ #
281
+ # def perform_inplace_option(parser)
282
+ # # Specifies an optional option argument
283
+ # parser.on("-i", "--inplace [EXTENSION]",
284
+ # "Edit ARGV files in place",
285
+ # "(make backup if EXTENSION supplied)") do |ext|
286
+ # self.inplace = true
287
+ # self.extension = ext || ''
288
+ # self.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
289
+ # end
290
+ # end
291
+ #
292
+ # def delay_execution_option(parser)
293
+ # # Cast 'delay' argument to a Float.
294
+ # parser.on("--delay N", Float, "Delay N seconds before executing") do |n|
295
+ # self.delay = n
296
+ # end
297
+ # end
298
+ #
299
+ # def execute_at_time_option(parser)
300
+ # # Cast 'time' argument to a Time object.
301
+ # parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
302
+ # self.time = time
303
+ # end
304
+ # end
305
+ #
306
+ # def specify_record_separator_option(parser)
307
+ # # Cast to octal integer.
308
+ # parser.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger,
309
+ # "Specify record separator (default \\0)") do |rs|
310
+ # self.record_separator = rs
311
+ # end
312
+ # end
313
+ #
314
+ # def list_example_option(parser)
315
+ # # List of arguments.
316
+ # parser.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
317
+ # self.list = list
318
+ # end
319
+ # end
320
+ #
321
+ # def specify_encoding_option(parser)
322
+ # # Keyword completion. We are specifying a specific set of arguments (CODES
323
+ # # and CODE_ALIASES - notice the latter is a Hash), and the user may provide
324
+ # # the shortest unambiguous text.
325
+ # code_list = (CODE_ALIASES.keys + CODES).join(', ')
326
+ # parser.on("--code CODE", CODES, CODE_ALIASES, "Select encoding",
327
+ # "(#{code_list})") do |encoding|
328
+ # self.encoding = encoding
329
+ # end
330
+ # end
331
+ #
332
+ # def optional_option_argument_with_keyword_completion_option(parser)
333
+ # # Optional '--type' option argument with keyword completion.
334
+ # parser.on("--type [TYPE]", [:text, :binary, :auto],
335
+ # "Select transfer type (text, binary, auto)") do |t|
336
+ # self.transfer_type = t
337
+ # end
338
+ # end
339
+ #
340
+ # def boolean_verbose_option(parser)
341
+ # # Boolean switch.
342
+ # parser.on("-v", "--[no-]verbose", "Run verbosely") do |v|
343
+ # self.verbose = v
344
+ # end
345
+ # end
346
+ # end
347
+ #
348
+ # #
349
+ # # Return a structure describing the options.
350
+ # #
351
+ # def parse(args)
352
+ # # The options specified on the command line will be collected in
353
+ # # *options*.
354
+ #
355
+ # @options = ScriptOptions.new
356
+ # @args = OptionParser.new do |parser|
357
+ # @options.define_options(parser)
358
+ # parser.parse!(args)
359
+ # end
360
+ # @options
361
+ # end
362
+ #
363
+ # attr_reader :parser, :options
364
+ # end # class OptparseExample
365
+ #
366
+ # example = OptparseExample.new
367
+ # options = example.parse(ARGV)
368
+ # pp options # example.options
369
+ # pp ARGV
370
+ #
371
+ # ### Shell Completion
372
+ #
373
+ # For modern shells (e.g. bash, zsh, etc.), you can use shell completion for
374
+ # command line options.
375
+ #
376
+ # ### Further documentation
377
+ #
378
+ # The above examples, along with the accompanying
379
+ # [Tutorial](optparse/tutorial.rdoc), should be enough to learn how to use this
380
+ # class. If you have any questions, file a ticket at http://bugs.ruby-lang.org.
381
+ #
382
+ class OptionParser
383
+ interface _Pattern
384
+ def match: (untyped other) -> boolish
385
+ end
386
+
387
+ interface _Intoable
388
+ def []=: (Symbol, untyped) -> untyped
389
+ end
390
+
391
+ interface _LtLtString
392
+ def <<: (String) -> untyped
393
+ end
394
+
395
+ # <!--
396
+ # rdoc-file=lib/optparse.rb
397
+ # - accept(*args, &blk)
398
+ # -->
399
+ # See #accept.
400
+ #
401
+ def self.accept: (Class t, ?_Pattern pat) ?{ (*untyped) -> untyped } -> void
402
+
403
+ # <!--
404
+ # rdoc-file=lib/optparse.rb
405
+ # - getopts(*args, symbolize_names: false)
406
+ # -->
407
+ # See #getopts.
408
+ #
409
+ def self.getopts: (*String options) -> Hash[String, untyped]
410
+ | (Array[String] args, *String options) -> Hash[String, untyped]
411
+
412
+ # <!--
413
+ # rdoc-file=lib/optparse.rb
414
+ # - inc(arg, default = nil)
415
+ # -->
416
+ # Returns an incremented value of `default` according to `arg`.
417
+ #
418
+ def self.inc: (untyped arg, ?_ToI default) -> Integer?
419
+
420
+ # <!--
421
+ # rdoc-file=lib/optparse.rb
422
+ # - reject(*args, &blk)
423
+ # -->
424
+ # See #reject.
425
+ #
426
+ def self.reject: (Class t) -> void
427
+
428
+ # <!--
429
+ # rdoc-file=lib/optparse.rb
430
+ # - terminate(arg = nil)
431
+ # -->
432
+ # See #terminate.
433
+ #
434
+ def self.terminate: (?String arg) -> bot
435
+
436
+ # <!--
437
+ # rdoc-file=lib/optparse.rb
438
+ # - top()
439
+ # -->
440
+ # Returns the global top option list.
441
+ #
442
+ # Do not use directly.
443
+ #
444
+ def self.top: () -> OptionParser::List
445
+
446
+ # <!--
447
+ # rdoc-file=lib/optparse.rb
448
+ # - with(*args, &block)
449
+ # -->
450
+ # Initializes a new instance and evaluates the optional block in context of the
451
+ # instance. Arguments `args` are passed to #new, see there for description of
452
+ # parameters.
453
+ #
454
+ # This method is **deprecated**, its behavior corresponds to the older #new
455
+ # method.
456
+ #
457
+ def self.with: (?String banner, ?Integer width, ?String indent) ?{ (instance opts) -> void } -> instance
458
+
459
+ # <!--
460
+ # rdoc-file=lib/optparse.rb
461
+ # - abort(mesg = $!)
462
+ # -->
463
+ # Shows message with the program name then aborts.
464
+ #
465
+ # `mesg`
466
+ # : Message, defaulted to +$!+.
467
+ #
468
+ #
469
+ # See Kernel#abort.
470
+ #
471
+ def abort: (?_ToS mesg) -> bot
472
+
473
+ # <!--
474
+ # rdoc-file=lib/optparse.rb
475
+ # - accept(*args, &blk)
476
+ # -->
477
+ # Directs to accept specified class `t`. The argument string is passed to the
478
+ # block in which it should be converted to the desired class.
479
+ #
480
+ # `t`
481
+ # : Argument class specifier, any object including Class.
482
+ #
483
+ # `pat`
484
+ # : Pattern for argument, defaults to `t` if it responds to match.
485
+ #
486
+ #
487
+ # accept(t, pat, &block)
488
+ #
489
+ def accept: (Class t, ?_Pattern pat) ?{ (*untyped) -> untyped } -> void
490
+
491
+ def add_officious: () -> void
492
+
493
+ # <!--
494
+ # rdoc-file=lib/optparse.rb
495
+ # - additional_message(typ, opt)
496
+ # -->
497
+ # Returns additional info.
498
+ #
499
+ def additional_message: (untyped typ, untyped opt) -> String?
500
+
501
+ # <!-- rdoc-file=lib/optparse.rb -->
502
+ # Heading banner preceding summary.
503
+ #
504
+ attr_accessor banner: String
505
+
506
+ # <!--
507
+ # rdoc-file=lib/optparse.rb
508
+ # - base()
509
+ # -->
510
+ # Subject of #on_tail.
511
+ #
512
+ def base: () -> List
513
+
514
+ # <!--
515
+ # rdoc-file=lib/optparse.rb
516
+ # - candidate(word)
517
+ # -->
518
+ # Return candidates for `word`.
519
+ #
520
+ def candidate: (String word) -> Array[untyped]
521
+
522
+ def compsys: (untyped to, ?untyped name) -> untyped
523
+
524
+ # <!--
525
+ # rdoc-file=lib/optparse.rb
526
+ # - def_head_option(*opts, &block)
527
+ # -->
528
+ #
529
+ alias def_head_option define_head
530
+
531
+ # <!--
532
+ # rdoc-file=lib/optparse.rb
533
+ # - def_option(*opts, &block)
534
+ # -->
535
+ #
536
+ alias def_option define
537
+
538
+ # <!--
539
+ # rdoc-file=lib/optparse.rb
540
+ # - def_tail_option(*opts, &block)
541
+ # -->
542
+ #
543
+ alias def_tail_option define_tail
544
+
545
+ # <!-- rdoc-file=lib/optparse.rb -->
546
+ # Strings to be parsed in default.
547
+ #
548
+ attr_accessor default_argv: Array[String]
549
+
550
+ # <!--
551
+ # rdoc-file=lib/optparse.rb
552
+ # - define(*params, &block)
553
+ # -->
554
+ # Creates an option from the given parameters `params`. See [Parameters for New
555
+ # Options](optparse/option_params.rdoc).
556
+ #
557
+ # The block, if given, is the handler for the created option. When the option is
558
+ # encountered during command-line parsing, the block is called with the argument
559
+ # given for the option, if any. See [Option
560
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
561
+ #
562
+ def define: (*String params) ?{ (*untyped) -> untyped } -> untyped
563
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> untyped
564
+ | (*String params, Proc | Method handler) -> untyped
565
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> untyped
566
+
567
+ # <!--
568
+ # rdoc-file=lib/optparse.rb
569
+ # - define_head(*params, &block)
570
+ # -->
571
+ # Creates an option from the given parameters `params`. See [Parameters for New
572
+ # Options](optparse/option_params.rdoc).
573
+ #
574
+ # The block, if given, is the handler for the created option. When the option is
575
+ # encountered during command-line parsing, the block is called with the argument
576
+ # given for the option, if any. See [Option
577
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
578
+ #
579
+ def define_head: (*String params) ?{ (*untyped) -> untyped } -> untyped
580
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> untyped
581
+ | (*String params, Proc | Method handler) -> untyped
582
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> untyped
583
+
584
+ # <!--
585
+ # rdoc-file=lib/optparse.rb
586
+ # - define_tail(*params, &block)
587
+ # -->
588
+ # Creates an option from the given parameters `params`. See [Parameters for New
589
+ # Options](optparse/option_params.rdoc).
590
+ #
591
+ # The block, if given, is the handler for the created option. When the option is
592
+ # encountered during command-line parsing, the block is called with the argument
593
+ # given for the option, if any. See [Option
594
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
595
+ #
596
+ def define_tail: (*String params) ?{ (*untyped) -> untyped } -> untyped
597
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> untyped
598
+ | (*String params, Proc | Method handler) -> untyped
599
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> untyped
600
+
601
+ # <!--
602
+ # rdoc-file=lib/optparse.rb
603
+ # - environment(env = File.basename($0, '.*'), **keywords)
604
+ # -->
605
+ # Parses environment variable `env` or its uppercase with splitting like a
606
+ # shell.
607
+ #
608
+ # `env` defaults to the basename of the program.
609
+ #
610
+ def environment: (?String env) -> Array[String]?
611
+
612
+ # <!--
613
+ # rdoc-file=lib/optparse.rb
614
+ # - getopts(*args, symbolize_names: false, **keywords)
615
+ # -->
616
+ # Wrapper method for getopts.rb.
617
+ #
618
+ # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option")
619
+ # # params["a"] = true # -a
620
+ # # params["b"] = "1" # -b1
621
+ # # params["foo"] = "1" # --foo
622
+ # # params["bar"] = "x" # --bar x
623
+ # # params["zot"] = "z" # --zot Z
624
+ #
625
+ # Option `symbolize_names` (boolean) specifies whether returned Hash keys should
626
+ # be Symbols; defaults to `false` (use Strings).
627
+ #
628
+ # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option", symbolize_names: true)
629
+ # # params[:a] = true # -a
630
+ # # params[:b] = "1" # -b1
631
+ # # params[:foo] = "1" # --foo
632
+ # # params[:bar] = "x" # --bar x
633
+ # # params[:zot] = "z" # --zot Z
634
+ #
635
+ def getopts: (*String options) -> Hash[String, untyped]
636
+ | (Array[String] args, *String options) -> Hash[String, untyped]
637
+
638
+ # <!--
639
+ # rdoc-file=lib/optparse.rb
640
+ # - help()
641
+ # -->
642
+ # Returns option summary string.
643
+ #
644
+ def help: () -> String
645
+
646
+ # <!--
647
+ # rdoc-file=lib/optparse.rb
648
+ # - inc(*args)
649
+ # -->
650
+ # See self.inc
651
+ #
652
+ def inc: (*untyped args) -> untyped
653
+
654
+ # <!--
655
+ # rdoc-file=lib/optparse.rb
656
+ # - load(filename = nil, **keywords)
657
+ # -->
658
+ # Loads options from file names as `filename`. Does nothing when the file is not
659
+ # present. Returns whether successfully loaded.
660
+ #
661
+ # `filename` defaults to basename of the program without suffix in a directory
662
+ # ~/.options, then the basename with '.options' suffix under XDG and Haiku
663
+ # standard places.
664
+ #
665
+ # The optional `into` keyword argument works exactly like that accepted in
666
+ # method #parse.
667
+ #
668
+ def load: (?String filename) -> bool
669
+
670
+ # <!--
671
+ # rdoc-file=lib/optparse.rb
672
+ # - make_switch(params, block = nil)
673
+ # -->
674
+ # Creates an option from the given parameters `params`. See [Parameters for New
675
+ # Options](optparse/option_params.rdoc).
676
+ #
677
+ # The block, if given, is the handler for the created option. When the option is
678
+ # encountered during command-line parsing, the block is called with the argument
679
+ # given for the option, if any. See [Option
680
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
681
+ #
682
+ def make_switch: (Array[untyped] opts, ?Proc block) -> [ untyped, untyped, untyped, untyped, untyped ]
683
+
684
+ # <!--
685
+ # rdoc-file=lib/optparse.rb
686
+ # - new() { |self| ... }
687
+ # -->
688
+ # Pushes a new List.
689
+ #
690
+ # If a block is given, yields `self` and returns the result of the block,
691
+ # otherwise returns `self`.
692
+ #
693
+ def new: () -> self
694
+ | [T] () { (self) -> T } -> T
695
+
696
+ # <!--
697
+ # rdoc-file=lib/optparse.rb
698
+ # - on(*params, &block)
699
+ # -->
700
+ # Creates an option from the given parameters `params`. See [Parameters for New
701
+ # Options](optparse/option_params.rdoc).
702
+ #
703
+ # The block, if given, is the handler for the created option. When the option is
704
+ # encountered during command-line parsing, the block is called with the argument
705
+ # given for the option, if any. See [Option
706
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
707
+ #
708
+ def on: (*String params) ?{ (*untyped) -> untyped } -> self
709
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> self
710
+ | (String short_params, String long_params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> self
711
+ | (*String params, Proc | Method handler) -> self
712
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
713
+ | (String short_params, String long_params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
714
+
715
+ # <!--
716
+ # rdoc-file=lib/optparse.rb
717
+ # - on_head(*params, &block)
718
+ # -->
719
+ # Creates an option from the given parameters `params`. See [Parameters for New
720
+ # Options](optparse/option_params.rdoc).
721
+ #
722
+ # The block, if given, is the handler for the created option. When the option is
723
+ # encountered during command-line parsing, the block is called with the argument
724
+ # given for the option, if any. See [Option
725
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
726
+ #
727
+ # The new option is added at the head of the summary.
728
+ #
729
+ def on_head: (*String params) ?{ (*untyped) -> untyped } -> self
730
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> self
731
+ | (String short_params, String long_params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> self
732
+ | (*String params, Proc | Method handler) -> self
733
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
734
+ | (String short_params, String long_params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
735
+
736
+ # <!--
737
+ # rdoc-file=lib/optparse.rb
738
+ # - on_tail(*params, &block)
739
+ # -->
740
+ # Creates an option from the given parameters `params`. See [Parameters for New
741
+ # Options](optparse/option_params.rdoc).
742
+ #
743
+ # The block, if given, is the handler for the created option. When the option is
744
+ # encountered during command-line parsing, the block is called with the argument
745
+ # given for the option, if any. See [Option
746
+ # Handlers](optparse/option_params.rdoc#label-Option+Handlers).
747
+ #
748
+ # The new option is added at the tail of the summary.
749
+ #
750
+ def on_tail: (*String params) ?{ (*untyped) -> untyped } -> self
751
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> self
752
+ | (String short_params, String long_params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc) ?{ (*untyped) -> untyped } -> self
753
+ | (*String params, Proc | Method handler) -> self
754
+ | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
755
+ | (String short_params, String long_params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
756
+
757
+ # <!--
758
+ # rdoc-file=lib/optparse.rb
759
+ # - order(*argv, **keywords, &nonopt)
760
+ # -->
761
+ # Parses command line arguments `argv` in order. When a block is given, each
762
+ # non-option argument is yielded. When optional `into` keyword argument is
763
+ # provided, the parsed option values are stored there via `[]=` method (so it
764
+ # can be Hash, or OpenStruct, or other similar object).
765
+ #
766
+ # Returns the rest of `argv` left unparsed.
767
+ #
768
+ def order: (*String argv, ?into: _Intoable) ?{ (String) -> void } -> Array[String]
769
+ | (Array[String] argv, ?into: _Intoable) ?{ (String) -> void } -> Array[String]
770
+
771
+ # <!--
772
+ # rdoc-file=lib/optparse.rb
773
+ # - order!(argv = default_argv, into: nil, **keywords, &nonopt)
774
+ # -->
775
+ # Same as #order, but removes switches destructively. Non-option arguments
776
+ # remain in `argv`.
777
+ #
778
+ def order!: (?Array[String] argv, ?into: _Intoable) ?{ (String) -> void } -> Array[String]
779
+
780
+ # <!--
781
+ # rdoc-file=lib/optparse.rb
782
+ # - parse(*argv, **keywords)
783
+ # -->
784
+ # Parses command line arguments `argv` in order when environment variable
785
+ # POSIXLY_CORRECT is set, and in permutation mode otherwise. When optional
786
+ # `into` keyword argument is provided, the parsed option values are stored there
787
+ # via `[]=` method (so it can be Hash, or OpenStruct, or other similar object).
788
+ #
789
+ def parse: (*String argv, ?into: _Intoable) -> Array[String]
790
+ | (Array[String] argv, ?into: _Intoable) -> Array[String]
791
+
792
+ # <!--
793
+ # rdoc-file=lib/optparse.rb
794
+ # - parse!(argv = default_argv, **keywords)
795
+ # -->
796
+ # Same as #parse, but removes switches destructively. Non-option arguments
797
+ # remain in `argv`.
798
+ #
799
+ def parse!: (?Array[String] argv, ?into: _Intoable) -> Array[String]
800
+
801
+ # <!--
802
+ # rdoc-file=lib/optparse.rb
803
+ # - permute(*argv, **keywords)
804
+ # -->
805
+ # Parses command line arguments `argv` in permutation mode and returns list of
806
+ # non-option arguments. When optional `into` keyword argument is provided, the
807
+ # parsed option values are stored there via `[]=` method (so it can be Hash, or
808
+ # OpenStruct, or other similar object).
809
+ #
810
+ def permute: (*String argv, ?into: _Intoable) -> Array[String]
811
+ | (Array[String] argv, ?into: _Intoable) -> Array[String]
812
+
813
+ # <!--
814
+ # rdoc-file=lib/optparse.rb
815
+ # - permute!(argv = default_argv, **keywords)
816
+ # -->
817
+ # Same as #permute, but removes switches destructively. Non-option arguments
818
+ # remain in `argv`.
819
+ #
820
+ def permute!: (?Array[String] argv, ?into: _Intoable) -> Array[String]
821
+
822
+ # <!-- rdoc-file=lib/optparse.rb -->
823
+ # Program name to be emitted in error message and default banner, defaults to
824
+ # $0.
825
+ #
826
+ attr_accessor program_name: String
827
+
828
+ # <!--
829
+ # rdoc-file=lib/optparse.rb
830
+ # - reject(*args, &blk)
831
+ # -->
832
+ # Directs to reject specified class argument.
833
+ #
834
+ # `type`
835
+ # : Argument class specifier, any object including Class.
836
+ #
837
+ #
838
+ # reject(type)
839
+ #
840
+ def reject: (Class t) -> void
841
+
842
+ # <!-- rdoc-file=lib/optparse.rb -->
843
+ # Release code
844
+ #
845
+ def release: () -> untyped
846
+
847
+ # <!-- rdoc-file=lib/optparse.rb -->
848
+ # Release code
849
+ #
850
+ def release=: (untyped) -> untyped
851
+
852
+ # <!--
853
+ # rdoc-file=lib/optparse.rb
854
+ # - remove()
855
+ # -->
856
+ # Removes the last List.
857
+ #
858
+ def remove: () -> List?
859
+
860
+ # <!-- rdoc-file=lib/optparse.rb -->
861
+ # Whether to require that options match exactly (disallows providing abbreviated
862
+ # long option as short option).
863
+ #
864
+ attr_accessor require_exact: boolish
865
+
866
+ # <!--
867
+ # rdoc-file=lib/optparse.rb
868
+ # - separator(string)
869
+ # -->
870
+ # Add separator in summary.
871
+ #
872
+ def separator: (String string) -> void
873
+
874
+ # Heading banner preceding summary.
875
+ #
876
+ alias set_banner banner=
877
+
878
+ # Program name to be emitted in error message and default banner, defaults to
879
+ # $0.
880
+ #
881
+ alias set_program_name program_name=
882
+
883
+ # <!-- rdoc-file=lib/optparse.rb -->
884
+ # Indentation for summary. Must be String (or have + String method).
885
+ #
886
+ alias set_summary_indent summary_indent=
887
+
888
+ # <!-- rdoc-file=lib/optparse.rb -->
889
+ # Width for option list portion of summary. Must be Numeric.
890
+ #
891
+ alias set_summary_width summary_width=
892
+
893
+ # <!--
894
+ # rdoc-file=lib/optparse.rb
895
+ # - summarize(to = [], width = @summary_width, max = width - 1, indent = @summary_indent, &blk)
896
+ # -->
897
+ # Puts option summary into `to` and returns `to`. Yields each line if a block is
898
+ # given.
899
+ #
900
+ # `to`
901
+ # : Output destination, which must have method <<. Defaults to [].
902
+ #
903
+ # `width`
904
+ # : Width of left side, defaults to @summary_width.
905
+ #
906
+ # `max`
907
+ # : Maximum length allowed for left side, defaults to `width` - 1.
908
+ #
909
+ # `indent`
910
+ # : Indentation, defaults to @summary_indent.
911
+ #
912
+ def summarize: (?_LtLtString to, ?Integer width, ?Integer max, ?String indent) ?{ (String line) -> void } -> _LtLtString
913
+
914
+ # <!-- rdoc-file=lib/optparse.rb -->
915
+ # Indentation for summary. Must be String (or have + String method).
916
+ #
917
+ attr_accessor summary_indent: String
918
+
919
+ # <!-- rdoc-file=lib/optparse.rb -->
920
+ # Width for option list portion of summary. Must be Numeric.
921
+ #
922
+ attr_accessor summary_width: Integer
923
+
924
+ # <!--
925
+ # rdoc-file=lib/optparse.rb
926
+ # - terminate(arg = nil)
927
+ # -->
928
+ # Terminates option parsing. Optional parameter `arg` is a string pushed back to
929
+ # be the first non-option argument.
930
+ #
931
+ def terminate: (?String arg) -> bot
932
+
933
+ # <!--
934
+ # rdoc-file=lib/optparse.rb
935
+ # - to_a()
936
+ # -->
937
+ # Returns option summary list.
938
+ #
939
+ def to_a: () -> Array[String]
940
+
941
+ # <!--
942
+ # rdoc-file=lib/optparse.rb
943
+ # - to_s()
944
+ # -->
945
+ #
946
+ alias to_s help
947
+
948
+ # <!--
949
+ # rdoc-file=lib/optparse.rb
950
+ # - top()
951
+ # -->
952
+ # Subject of #on / #on_head, #accept / #reject
953
+ #
954
+ def top: () -> List
955
+
956
+ # <!--
957
+ # rdoc-file=lib/optparse.rb
958
+ # - ver()
959
+ # -->
960
+ # Returns version string from program_name, version and release.
961
+ #
962
+ def ver: () -> String?
963
+
964
+ # <!-- rdoc-file=lib/optparse.rb -->
965
+ # Version
966
+ #
967
+ attr_accessor version: String?
968
+
969
+ # <!--
970
+ # rdoc-file=lib/optparse.rb
971
+ # - warn(mesg = $!)
972
+ # -->
973
+ # Shows warning message with the program name
974
+ #
975
+ # `mesg`
976
+ # : Message, defaulted to +$!+.
977
+ #
978
+ #
979
+ # See Kernel#warn.
980
+ #
981
+ def warn: (?_ToS mesg) -> void
982
+
983
+ private
984
+
985
+ # <!--
986
+ # rdoc-file=lib/optparse.rb
987
+ # - complete(typ, opt, icase = false, *pat)
988
+ # -->
989
+ # Completes shortened long style option switch and returns pair of canonical
990
+ # switch and switch descriptor OptionParser::Switch.
991
+ #
992
+ # `typ`
993
+ # : Searching table.
994
+ # `opt`
995
+ # : Searching key.
996
+ # `icase`
997
+ # : Search case insensitive if true.
998
+ # `pat`
999
+ # : Optional pattern for completion.
1000
+ #
1001
+ def complete: (untyped typ, untyped opt, ?untyped icase, *untyped pat) -> untyped
1002
+
1003
+ # <!--
1004
+ # rdoc-file=lib/optparse.rb
1005
+ # - new(banner = nil, width = 32, indent = ' ' * 4) { |self| ... }
1006
+ # -->
1007
+ # Initializes the instance and yields itself if called with a block.
1008
+ #
1009
+ # `banner`
1010
+ # : Banner message.
1011
+ #
1012
+ # `width`
1013
+ # : Summary width.
1014
+ #
1015
+ # `indent`
1016
+ # : Summary indent.
1017
+ #
1018
+ def initialize: (?String banner, ?Integer width, ?String indent) ?{ (OptionParser) -> void } -> void
1019
+
1020
+ # <!--
1021
+ # rdoc-file=lib/optparse.rb
1022
+ # - notwice(obj, prv, msg)
1023
+ # -->
1024
+ # Checks if an argument is given twice, in which case an ArgumentError is
1025
+ # raised. Called from OptionParser#switch only.
1026
+ #
1027
+ # `obj`
1028
+ # : New argument.
1029
+ # `prv`
1030
+ # : Previously specified argument.
1031
+ # `msg`
1032
+ # : Exception message.
1033
+ #
1034
+ def notwice: (untyped obj, untyped prv, untyped msg) -> untyped
1035
+
1036
+ def parse_in_order: (?untyped argv, ?untyped setter) { (*untyped) -> untyped } -> untyped
1037
+
1038
+ # <!--
1039
+ # rdoc-file=lib/optparse.rb
1040
+ # - search(id, key) { |k| ... }
1041
+ # -->
1042
+ # Searches `key` in @stack for `id` hash and returns or yields the result.
1043
+ #
1044
+ def search: (untyped id, untyped key) -> untyped
1045
+
1046
+ # <!--
1047
+ # rdoc-file=lib/optparse.rb
1048
+ # - visit(id, *args, &block)
1049
+ # -->
1050
+ # Traverses @stack, sending each element method `id` with `args` and `block`.
1051
+ #
1052
+ def visit: (untyped id, *untyped args) { (*untyped) -> untyped } -> untyped
1053
+ end
1054
+
1055
+ OptionParser::ArgumentStyle: Hash[untyped, untyped]
1056
+
1057
+ OptionParser::COMPSYS_HEADER: String
1058
+
1059
+ # <!-- rdoc-file=lib/optparse.rb -->
1060
+ # Decimal integer format, to be converted to Integer.
1061
+ #
1062
+ OptionParser::DecimalInteger: Regexp
1063
+
1064
+ # <!-- rdoc-file=lib/optparse.rb -->
1065
+ # Decimal integer/float number format, to be converted to Integer for integer
1066
+ # format, Float for float format.
1067
+ #
1068
+ OptionParser::DecimalNumeric: Regexp
1069
+
1070
+ OptionParser::DefaultList: OptionParser::List
1071
+
1072
+ OptionParser::NO_ARGUMENT: Symbol
1073
+
1074
+ OptionParser::NoArgument: [ :NONE, nil ]
1075
+
1076
+ OptionParser::OPTIONAL_ARGUMENT: Symbol
1077
+
1078
+ # <!-- rdoc-file=lib/optparse.rb -->
1079
+ # Ruby/C like octal/hexadecimal/binary integer format, to be converted to
1080
+ # Integer.
1081
+ #
1082
+ OptionParser::OctalInteger: Regexp
1083
+
1084
+ OptionParser::Officious: Hash[untyped, untyped]
1085
+
1086
+ OptionParser::OptionalArgument: Array[untyped]
1087
+
1088
+ OptionParser::REQUIRED_ARGUMENT: Symbol
1089
+
1090
+ OptionParser::RequiredArgument: Array[untyped]
1091
+
1092
+ OptionParser::SPLAT_PROC: Proc
1093
+
1094
+ # <!-- rdoc-file=lib/optparse.rb -->
1095
+ # The version string
1096
+ #
1097
+ OptionParser::Version: String
1098
+
1099
+ # <!-- rdoc-file=lib/optparse.rb -->
1100
+ # Acceptable argument classes. Now contains DecimalInteger, OctalInteger and
1101
+ # DecimalNumeric. See Acceptable argument classes (in source code).
1102
+ #
1103
+ module OptionParser::Acceptables
1104
+ end
1105
+
1106
+ OptionParser::Acceptables::DecimalInteger: Regexp
1107
+
1108
+ OptionParser::Acceptables::DecimalNumeric: Regexp
1109
+
1110
+ OptionParser::Acceptables::OctalInteger: Regexp
1111
+
1112
+ # <!-- rdoc-file=lib/optparse.rb -->
1113
+ # Raises when the given argument word can't be completed uniquely.
1114
+ #
1115
+ class OptionParser::AmbiguousArgument < OptionParser::InvalidArgument
1116
+ end
1117
+
1118
+ OptionParser::AmbiguousArgument::Reason: String
1119
+
1120
+ # <!-- rdoc-file=lib/optparse.rb -->
1121
+ # Raises when ambiguously completable string is encountered.
1122
+ #
1123
+ class OptionParser::AmbiguousOption < OptionParser::ParseError
1124
+ end
1125
+
1126
+ OptionParser::AmbiguousOption::Reason: String
1127
+
1128
+ # <!-- rdoc-file=lib/optparse.rb -->
1129
+ # Extends command line arguments array (ARGV) to parse itself.
1130
+ #
1131
+ module OptionParser::Arguable
1132
+ # <!--
1133
+ # rdoc-file=lib/optparse.rb
1134
+ # - extend_object(obj)
1135
+ # -->
1136
+ # Initializes instance variable.
1137
+ #
1138
+ def self.extend_object: (untyped obj) -> untyped
1139
+
1140
+ # <!--
1141
+ # rdoc-file=lib/optparse.rb
1142
+ # - getopts(*args, symbolize_names: false, **keywords)
1143
+ # -->
1144
+ # Substitution of getopts is possible as follows. Also see OptionParser#getopts.
1145
+ #
1146
+ # def getopts(*args)
1147
+ # ($OPT = ARGV.getopts(*args)).each do |opt, val|
1148
+ # eval "$OPT_#{opt.gsub(/[^A-Za-z0-9_]/, '_')} = val"
1149
+ # end
1150
+ # rescue OptionParser::ParseError
1151
+ # end
1152
+ #
1153
+ def getopts: (*String args) -> Hash[String, untyped]
1154
+
1155
+ # <!--
1156
+ # rdoc-file=lib/optparse.rb
1157
+ # - options() { |optparse| ... }
1158
+ # -->
1159
+ # Actual OptionParser object, automatically created if nonexistent.
1160
+ #
1161
+ # If called with a block, yields the OptionParser object and returns the result
1162
+ # of the block. If an OptionParser::ParseError exception occurs in the block, it
1163
+ # is rescued, a error message printed to STDERR and `nil` returned.
1164
+ #
1165
+ def options: () -> OptionParser
1166
+ | [T] () { (OptionParser) -> T } -> T?
1167
+
1168
+ # <!--
1169
+ # rdoc-file=lib/optparse.rb
1170
+ # - options=(opt)
1171
+ # -->
1172
+ # Sets OptionParser object, when `opt` is `false` or `nil`, methods
1173
+ # OptionParser::Arguable#options and OptionParser::Arguable#options= are
1174
+ # undefined. Thus, there is no ways to access the OptionParser object via the
1175
+ # receiver object.
1176
+ #
1177
+ def options=: (OptionParser? opt) -> untyped
1178
+
1179
+ # <!--
1180
+ # rdoc-file=lib/optparse.rb
1181
+ # - order!(**keywords, &blk)
1182
+ # -->
1183
+ # Parses `self` destructively in order and returns `self` containing the rest
1184
+ # arguments left unparsed.
1185
+ #
1186
+ def order!: () ?{ (String) -> void } -> Array[String]
1187
+
1188
+ # <!--
1189
+ # rdoc-file=lib/optparse.rb
1190
+ # - parse!(**keywords)
1191
+ # -->
1192
+ # Parses `self` destructively and returns `self` containing the rest arguments
1193
+ # left unparsed.
1194
+ #
1195
+ def parse!: () -> Array[String]
1196
+
1197
+ # <!--
1198
+ # rdoc-file=lib/optparse.rb
1199
+ # - permute!(**keywords)
1200
+ # -->
1201
+ # Parses `self` destructively in permutation mode and returns `self` containing
1202
+ # the rest arguments left unparsed.
1203
+ #
1204
+ def permute!: () -> Array[String]
1205
+ end
1206
+
1207
+ # <!-- rdoc-file=lib/optparse.rb -->
1208
+ # Hash with completion search feature. See OptionParser::Completion.
1209
+ #
1210
+ class OptionParser::CompletingHash < Hash[untyped, untyped]
1211
+ include OptionParser::Completion
1212
+
1213
+ # <!--
1214
+ # rdoc-file=lib/optparse.rb
1215
+ # - match(key)
1216
+ # -->
1217
+ # Completion for hash key.
1218
+ #
1219
+ def match: (untyped key) -> untyped
1220
+ end
1221
+
1222
+ # <!-- rdoc-file=lib/optparse.rb -->
1223
+ # Keyword completion module. This allows partial arguments to be specified and
1224
+ # resolved against a list of acceptable values.
1225
+ #
1226
+ module OptionParser::Completion
1227
+ # <!--
1228
+ # rdoc-file=lib/optparse.rb
1229
+ # - candidate(key, icase = false, pat = nil, &block)
1230
+ # -->
1231
+ #
1232
+ def self.candidate: (untyped key, ?untyped icase, ?untyped pat) { (*untyped) -> untyped } -> untyped
1233
+
1234
+ # <!--
1235
+ # rdoc-file=lib/optparse.rb
1236
+ # - regexp(key, icase)
1237
+ # -->
1238
+ #
1239
+ def self.regexp: (untyped key, untyped icase) -> untyped
1240
+
1241
+ # <!--
1242
+ # rdoc-file=lib/optparse.rb
1243
+ # - candidate(key, icase = false, pat = nil)
1244
+ # -->
1245
+ #
1246
+ def candidate: (untyped key, ?untyped icase, ?untyped pat) -> untyped
1247
+
1248
+ # <!--
1249
+ # rdoc-file=lib/optparse.rb
1250
+ # - complete(key, icase = false, pat = nil) { |key, *sw| ... }
1251
+ # -->
1252
+ #
1253
+ def complete: (untyped key, ?untyped icase, ?untyped pat) -> untyped
1254
+
1255
+ # <!--
1256
+ # rdoc-file=lib/optparse.rb
1257
+ # - convert(opt = nil, val = nil, *)
1258
+ # -->
1259
+ #
1260
+ def convert: (?untyped opt, ?untyped val, *untyped) -> untyped
1261
+ end
1262
+
1263
+ # <!-- rdoc-file=lib/optparse.rb -->
1264
+ # Raises when the given argument does not match required format.
1265
+ #
1266
+ class OptionParser::InvalidArgument < OptionParser::ParseError
1267
+ end
1268
+
1269
+ OptionParser::InvalidArgument::Reason: String
1270
+
1271
+ # <!-- rdoc-file=lib/optparse.rb -->
1272
+ # Raises when switch is undefined.
1273
+ #
1274
+ class OptionParser::InvalidOption < OptionParser::ParseError
1275
+ end
1276
+
1277
+ OptionParser::InvalidOption::Reason: String
1278
+
1279
+ # <!-- rdoc-file=lib/optparse.rb -->
1280
+ # Simple option list providing mapping from short and/or long option string to
1281
+ # OptionParser::Switch and mapping from acceptable argument to matching pattern
1282
+ # and converter pair. Also provides summary feature.
1283
+ #
1284
+ class OptionParser::List
1285
+ # <!--
1286
+ # rdoc-file=lib/optparse.rb
1287
+ # - accept(t, pat = /.*/m, &block)
1288
+ # -->
1289
+ # See OptionParser.accept.
1290
+ #
1291
+ def accept: (untyped t, ?untyped pat) { (*untyped) -> untyped } -> untyped
1292
+
1293
+ def add_banner: (untyped to) -> untyped
1294
+
1295
+ # <!--
1296
+ # rdoc-file=lib/optparse.rb
1297
+ # - append(*args)
1298
+ # -->
1299
+ # Appends `switch` at the tail of the list, and associates short, long and
1300
+ # negated long options. Arguments are:
1301
+ #
1302
+ # `switch`
1303
+ # : OptionParser::Switch instance to be inserted.
1304
+ #
1305
+ # `short_opts`
1306
+ # : List of short style options.
1307
+ #
1308
+ # `long_opts`
1309
+ # : List of long style options.
1310
+ #
1311
+ # `nolong_opts`
1312
+ # : List of long style options with "no-" prefix.
1313
+ #
1314
+ #
1315
+ # append(switch, short_opts, long_opts, nolong_opts)
1316
+ #
1317
+ def append: (*untyped args) -> untyped
1318
+
1319
+ # <!-- rdoc-file=lib/optparse.rb -->
1320
+ # Map from acceptable argument types to pattern and converter pairs.
1321
+ #
1322
+ def atype: () -> untyped
1323
+
1324
+ # <!--
1325
+ # rdoc-file=lib/optparse.rb
1326
+ # - complete(id, opt, icase = false, *pat, &block)
1327
+ # -->
1328
+ # Searches list `id` for `opt` and the optional patterns for completion `pat`.
1329
+ # If `icase` is true, the search is case insensitive. The result is returned or
1330
+ # yielded if a block is given. If it isn't found, nil is returned.
1331
+ #
1332
+ def complete: (untyped id, untyped opt, ?untyped icase, *untyped pat) { (*untyped) -> untyped } -> untyped
1333
+
1334
+ def compsys: (*untyped args) { (*untyped) -> untyped } -> untyped
1335
+
1336
+ # <!--
1337
+ # rdoc-file=lib/optparse.rb
1338
+ # - each_option(&block)
1339
+ # -->
1340
+ # Iterates over each option, passing the option to the `block`.
1341
+ #
1342
+ def each_option: () { (*untyped) -> untyped } -> untyped
1343
+
1344
+ # <!--
1345
+ # rdoc-file=lib/optparse.rb
1346
+ # - get_candidates(id) { |__send__(id).keys| ... }
1347
+ # -->
1348
+ #
1349
+ def get_candidates: (untyped id) -> untyped
1350
+
1351
+ # <!-- rdoc-file=lib/optparse.rb -->
1352
+ # List of all switches and summary string.
1353
+ #
1354
+ def list: () -> untyped
1355
+
1356
+ # <!-- rdoc-file=lib/optparse.rb -->
1357
+ # Map from long style option switches to actual switch objects.
1358
+ #
1359
+ def long: () -> untyped
1360
+
1361
+ # <!--
1362
+ # rdoc-file=lib/optparse.rb
1363
+ # - prepend(*args)
1364
+ # -->
1365
+ # Inserts `switch` at the head of the list, and associates short, long and
1366
+ # negated long options. Arguments are:
1367
+ #
1368
+ # `switch`
1369
+ # : OptionParser::Switch instance to be inserted.
1370
+ #
1371
+ # `short_opts`
1372
+ # : List of short style options.
1373
+ #
1374
+ # `long_opts`
1375
+ # : List of long style options.
1376
+ #
1377
+ # `nolong_opts`
1378
+ # : List of long style options with "no-" prefix.
1379
+ #
1380
+ #
1381
+ # prepend(switch, short_opts, long_opts, nolong_opts)
1382
+ #
1383
+ def prepend: (*untyped args) -> untyped
1384
+
1385
+ # <!--
1386
+ # rdoc-file=lib/optparse.rb
1387
+ # - reject(t)
1388
+ # -->
1389
+ # See OptionParser.reject.
1390
+ #
1391
+ def reject: (untyped t) -> untyped
1392
+
1393
+ # <!--
1394
+ # rdoc-file=lib/optparse.rb
1395
+ # - search(id, key) { |val| ... }
1396
+ # -->
1397
+ # Searches `key` in `id` list. The result is returned or yielded if a block is
1398
+ # given. If it isn't found, nil is returned.
1399
+ #
1400
+ def search: (untyped id, untyped key) -> untyped
1401
+
1402
+ # <!-- rdoc-file=lib/optparse.rb -->
1403
+ # Map from short style option switches to actual switch objects.
1404
+ #
1405
+ def short: () -> untyped
1406
+
1407
+ # <!--
1408
+ # rdoc-file=lib/optparse.rb
1409
+ # - summarize(*args, &block)
1410
+ # -->
1411
+ # Creates the summary table, passing each line to the `block` (without newline).
1412
+ # The arguments `args` are passed along to the summarize method which is called
1413
+ # on every option.
1414
+ #
1415
+ def summarize: (*untyped args) { (*untyped) -> untyped } -> untyped
1416
+
1417
+ private
1418
+
1419
+ # <!--
1420
+ # rdoc-file=lib/optparse.rb
1421
+ # - new()
1422
+ # -->
1423
+ # Just initializes all instance variables.
1424
+ #
1425
+ def initialize: () -> void
1426
+
1427
+ # <!--
1428
+ # rdoc-file=lib/optparse.rb
1429
+ # - update(sw, sopts, lopts, nsw = nil, nlopts = nil)
1430
+ # -->
1431
+ # Adds `sw` according to `sopts`, `lopts` and `nlopts`.
1432
+ #
1433
+ # `sw`
1434
+ # : OptionParser::Switch instance to be added.
1435
+ # `sopts`
1436
+ # : Short style option list.
1437
+ # `lopts`
1438
+ # : Long style option list.
1439
+ # `nlopts`
1440
+ # : Negated long style options list.
1441
+ #
1442
+ def update: (untyped sw, untyped sopts, untyped lopts, ?untyped nsw, ?untyped nlopts) -> untyped
1443
+ end
1444
+
1445
+ # <!-- rdoc-file=lib/optparse.rb -->
1446
+ # Raises when a switch with mandatory argument has no argument.
1447
+ #
1448
+ class OptionParser::MissingArgument < OptionParser::ParseError
1449
+ end
1450
+
1451
+ OptionParser::MissingArgument::Reason: String
1452
+
1453
+ # <!-- rdoc-file=lib/optparse.rb -->
1454
+ # Raises when there is an argument for a switch which takes no argument.
1455
+ #
1456
+ class OptionParser::NeedlessArgument < OptionParser::ParseError
1457
+ end
1458
+
1459
+ OptionParser::NeedlessArgument::Reason: String
1460
+
1461
+ # <!-- rdoc-file=lib/optparse.rb -->
1462
+ # Map from option/keyword string to object with completion.
1463
+ #
1464
+ class OptionParser::OptionMap < Hash[untyped, untyped]
1465
+ include OptionParser::Completion
1466
+ end
1467
+
1468
+ # <!-- rdoc-file=lib/optparse.rb -->
1469
+ # Base class of exceptions from OptionParser.
1470
+ #
1471
+ class OptionParser::ParseError < RuntimeError
1472
+ # <!--
1473
+ # rdoc-file=lib/optparse.rb
1474
+ # - filter_backtrace(array)
1475
+ # -->
1476
+ #
1477
+ def self.filter_backtrace: (untyped array) -> untyped
1478
+
1479
+ def additional: () -> untyped
1480
+
1481
+ def additional=: (untyped) -> untyped
1482
+
1483
+ def args: () -> untyped
1484
+
1485
+ # <!--
1486
+ # rdoc-file=lib/optparse.rb
1487
+ # - inspect()
1488
+ # -->
1489
+ #
1490
+ def inspect: () -> untyped
1491
+
1492
+ # <!--
1493
+ # rdoc-file=lib/optparse.rb
1494
+ # - message()
1495
+ # -->
1496
+ # Default stringizing method to emit standard error message.
1497
+ #
1498
+ def message: () -> String
1499
+
1500
+ # <!-- rdoc-file=lib/optparse.rb -->
1501
+ #
1502
+ def reason: () -> untyped
1503
+
1504
+ def reason=: (untyped) -> untyped
1505
+
1506
+ # <!--
1507
+ # rdoc-file=lib/optparse.rb
1508
+ # - recover(argv)
1509
+ # -->
1510
+ # Pushes back erred argument(s) to `argv`.
1511
+ #
1512
+ def recover: (untyped argv) -> untyped
1513
+
1514
+ # <!--
1515
+ # rdoc-file=lib/optparse.rb
1516
+ # - set_backtrace(array)
1517
+ # -->
1518
+ #
1519
+ def set_backtrace: (untyped array) -> untyped
1520
+
1521
+ # <!--
1522
+ # rdoc-file=lib/optparse.rb
1523
+ # - set_option(opt, eq)
1524
+ # -->
1525
+ #
1526
+ def set_option: (untyped opt, untyped eq) -> untyped
1527
+
1528
+ # <!--
1529
+ # rdoc-file=lib/optparse.rb
1530
+ # - to_s()
1531
+ # -->
1532
+ #
1533
+ alias to_s message
1534
+
1535
+ private
1536
+
1537
+ # <!--
1538
+ # rdoc-file=lib/optparse.rb
1539
+ # - new(*args, additional: nil)
1540
+ # -->
1541
+ #
1542
+ def initialize: (*untyped args, ?additional: untyped) -> void
1543
+ end
1544
+
1545
+ # <!-- rdoc-file=lib/optparse.rb -->
1546
+ # Reason which caused the error.
1547
+ #
1548
+ OptionParser::ParseError::Reason: String
1549
+
1550
+ # <!-- rdoc-file=lib/optparse.rb -->
1551
+ # Individual switch class. Not important to the user.
1552
+ #
1553
+ # Defined within Switch are several Switch-derived classes: NoArgument,
1554
+ # RequiredArgument, etc.
1555
+ #
1556
+ class OptionParser::Switch
1557
+ # <!--
1558
+ # rdoc-file=lib/optparse.rb
1559
+ # - guess(arg)
1560
+ # -->
1561
+ # Guesses argument style from `arg`. Returns corresponding OptionParser::Switch
1562
+ # class (OptionalArgument, etc.).
1563
+ #
1564
+ def self.guess: (untyped arg) -> untyped
1565
+
1566
+ # <!--
1567
+ # rdoc-file=lib/optparse.rb
1568
+ # - incompatible_argument_styles(arg, t)
1569
+ # -->
1570
+ #
1571
+ def self.incompatible_argument_styles: (untyped arg, untyped t) -> untyped
1572
+
1573
+ # <!--
1574
+ # rdoc-file=lib/optparse.rb
1575
+ # - pattern()
1576
+ # -->
1577
+ #
1578
+ def self.pattern: () -> untyped
1579
+
1580
+ def add_banner: (untyped to) -> untyped
1581
+
1582
+ def arg: () -> untyped
1583
+
1584
+ def block: () -> untyped
1585
+
1586
+ def compsys: (untyped sdone, untyped ldone) -> untyped
1587
+
1588
+ def conv: () -> untyped
1589
+
1590
+ def desc: () -> untyped
1591
+
1592
+ def long: () -> untyped
1593
+
1594
+ def match_nonswitch?: (untyped str) -> untyped
1595
+
1596
+ def pattern: () -> untyped
1597
+
1598
+ def short: () -> untyped
1599
+
1600
+ # <!--
1601
+ # rdoc-file=lib/optparse.rb
1602
+ # - summarize(sdone = {}, ldone = {}, width = 1, max = width - 1, indent = "") { |indent| ... }
1603
+ # -->
1604
+ # Produces the summary text. Each line of the summary is yielded to the block
1605
+ # (without newline).
1606
+ #
1607
+ # `sdone`
1608
+ # : Already summarized short style options keyed hash.
1609
+ #
1610
+ # `ldone`
1611
+ # : Already summarized long style options keyed hash.
1612
+ #
1613
+ # `width`
1614
+ # : Width of left side (option part). In other words, the right side
1615
+ # (description part) starts after `width` columns.
1616
+ #
1617
+ # `max`
1618
+ # : Maximum width of left side -> the options are filled within `max` columns.
1619
+ #
1620
+ # `indent`
1621
+ # : Prefix string indents all summarized lines.
1622
+ #
1623
+ def summarize: (?untyped sdone, ?untyped ldone, ?untyped width, ?untyped max, ?untyped indent) -> untyped
1624
+
1625
+ # <!--
1626
+ # rdoc-file=lib/optparse.rb
1627
+ # - switch_name()
1628
+ # -->
1629
+ # Main name of the switch.
1630
+ #
1631
+ def switch_name: () -> untyped
1632
+
1633
+ private
1634
+
1635
+ # <!--
1636
+ # rdoc-file=lib/optparse.rb
1637
+ # - conv_arg(arg, val = [])
1638
+ # -->
1639
+ # Parses argument, converts and returns `arg`, `block` and result of conversion.
1640
+ # Yields at semi-error condition instead of raising an exception.
1641
+ #
1642
+ def conv_arg: (untyped arg, ?untyped val) -> untyped
1643
+
1644
+ # <!--
1645
+ # rdoc-file=lib/optparse.rb
1646
+ # - new(pattern = nil, conv = nil, short = nil, long = nil, arg = nil, desc = ([] if short or long), block = nil, &_block)
1647
+ # -->
1648
+ #
1649
+ def initialize: (?untyped pattern, ?untyped conv, ?untyped short, ?untyped long, ?untyped arg, ?untyped desc, ?untyped block) { (*untyped) -> untyped } -> void
1650
+
1651
+ # <!--
1652
+ # rdoc-file=lib/optparse.rb
1653
+ # - parse_arg(arg) { |InvalidArgument, arg| ... }
1654
+ # -->
1655
+ # Parses `arg` and returns rest of `arg` and matched portion to the argument
1656
+ # pattern. Yields when the pattern doesn't match substring.
1657
+ #
1658
+ def parse_arg: (untyped arg) -> untyped
1659
+ end
1660
+
1661
+ # <!-- rdoc-file=lib/optparse.rb -->
1662
+ # Switch that takes no arguments.
1663
+ #
1664
+ class OptionParser::Switch::NoArgument < OptionParser::Switch
1665
+ # <!--
1666
+ # rdoc-file=lib/optparse.rb
1667
+ # - incompatible_argument_styles(*)
1668
+ # -->
1669
+ #
1670
+ def self.incompatible_argument_styles: (*untyped) -> untyped
1671
+
1672
+ # <!--
1673
+ # rdoc-file=lib/optparse.rb
1674
+ # - pattern()
1675
+ # -->
1676
+ #
1677
+ def self.pattern: () -> untyped
1678
+
1679
+ # <!--
1680
+ # rdoc-file=lib/optparse.rb
1681
+ # - parse(arg, argv) { |NeedlessArgument, arg| ... }
1682
+ # -->
1683
+ # Raises an exception if any arguments given.
1684
+ #
1685
+ def parse: (untyped arg, untyped argv) -> untyped
1686
+ end
1687
+
1688
+ # <!-- rdoc-file=lib/optparse.rb -->
1689
+ # Switch that can omit argument.
1690
+ #
1691
+ class OptionParser::Switch::OptionalArgument < OptionParser::Switch
1692
+ # <!--
1693
+ # rdoc-file=lib/optparse.rb
1694
+ # - parse(arg, argv, &error)
1695
+ # -->
1696
+ # Parses argument if given, or uses default value.
1697
+ #
1698
+ def parse: (untyped arg, untyped argv) { (*untyped) -> untyped } -> untyped
1699
+ end
1700
+
1701
+ # <!-- rdoc-file=lib/optparse.rb -->
1702
+ # Switch that takes an argument, which does not begin with '-' or is '-'.
1703
+ #
1704
+ class OptionParser::Switch::PlacedArgument < OptionParser::Switch
1705
+ # <!--
1706
+ # rdoc-file=lib/optparse.rb
1707
+ # - parse(arg, argv, &error)
1708
+ # -->
1709
+ # Returns nil if argument is not present or begins with '-' and is not '-'.
1710
+ #
1711
+ def parse: (untyped arg, untyped argv) { (*untyped) -> untyped } -> untyped
1712
+ end
1713
+
1714
+ # <!-- rdoc-file=lib/optparse.rb -->
1715
+ # Switch that takes an argument.
1716
+ #
1717
+ class OptionParser::Switch::RequiredArgument < OptionParser::Switch
1718
+ # <!--
1719
+ # rdoc-file=lib/optparse.rb
1720
+ # - parse(arg, argv, &_)
1721
+ # -->
1722
+ # Raises an exception if argument is not present.
1723
+ #
1724
+ def parse: (untyped arg, untyped argv) -> untyped
1725
+ end