rbs 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +6 -1
  5. data/core/array.rbs +2866 -1086
  6. data/core/basic_object.rbs +150 -30
  7. data/core/binding.rbs +33 -0
  8. data/core/builtin.rbs +4 -4
  9. data/core/class.rbs +43 -5
  10. data/core/comparable.rbs +57 -0
  11. data/core/complex.rbs +170 -4
  12. data/core/constants.rbs +51 -0
  13. data/core/deprecated.rbs +7 -0
  14. data/core/dir.rbs +305 -20
  15. data/core/encoding.rbs +472 -77
  16. data/core/enumerable.rbs +2173 -234
  17. data/core/enumerator.rbs +448 -182
  18. data/core/env.rbs +448 -1
  19. data/core/errno.rbs +1 -10
  20. data/core/errors.rbs +152 -2
  21. data/core/exception.rbs +201 -127
  22. data/core/false_class.rbs +27 -0
  23. data/core/fiber.rbs +118 -37
  24. data/core/fiber_error.rbs +8 -9
  25. data/core/file.rbs +1059 -139
  26. data/core/file_test.rbs +287 -32
  27. data/core/float.rbs +776 -300
  28. data/core/gc.rbs +185 -34
  29. data/core/global_variables.rbs +5 -1
  30. data/core/hash.rbs +1582 -649
  31. data/core/integer.rbs +974 -204
  32. data/core/io/buffer.rbs +710 -0
  33. data/core/io/wait.rbs +29 -8
  34. data/core/io.rbs +2438 -417
  35. data/core/kernel.rbs +2315 -316
  36. data/core/marshal.rbs +37 -2
  37. data/core/match_data.rbs +123 -6
  38. data/core/math.rbs +126 -6
  39. data/core/method.rbs +226 -102
  40. data/core/module.rbs +421 -45
  41. data/core/nil_class.rbs +64 -0
  42. data/core/numeric.rbs +620 -142
  43. data/core/object.rbs +453 -81
  44. data/core/object_space.rbs +92 -2
  45. data/core/proc.rbs +482 -285
  46. data/core/process.rbs +443 -34
  47. data/core/ractor.rbs +232 -9
  48. data/core/random.rbs +151 -52
  49. data/core/range.rbs +885 -160
  50. data/core/rational.rbs +122 -6
  51. data/core/rb_config.rbs +14 -4
  52. data/core/refinement.rbs +44 -0
  53. data/core/regexp.rbs +156 -14
  54. data/core/ruby_vm.rbs +42 -3
  55. data/core/signal.rbs +78 -39
  56. data/core/string.rbs +2123 -567
  57. data/core/string_io.rbs +204 -0
  58. data/core/struct.rbs +283 -28
  59. data/core/symbol.rbs +304 -30
  60. data/core/thread.rbs +1288 -688
  61. data/core/thread_group.rbs +66 -10
  62. data/core/time.rbs +643 -217
  63. data/core/trace_point.rbs +100 -12
  64. data/core/true_class.rbs +24 -0
  65. data/core/unbound_method.rbs +73 -7
  66. data/core/warning.rbs +37 -12
  67. data/docs/CONTRIBUTING.md +40 -34
  68. data/docs/stdlib.md +3 -102
  69. data/lib/rbs/annotate/annotations.rb +197 -0
  70. data/lib/rbs/annotate/formatter.rb +80 -0
  71. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  72. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  73. data/lib/rbs/annotate.rb +6 -0
  74. data/lib/rbs/cli.rb +45 -1
  75. data/lib/rbs/definition_builder.rb +5 -1
  76. data/lib/rbs/location_aux.rb +12 -0
  77. data/lib/rbs/prototype/rb.rb +12 -0
  78. data/lib/rbs/version.rb +1 -1
  79. data/sig/annotate/annotations.rbs +102 -0
  80. data/sig/annotate/formatter.rbs +24 -0
  81. data/sig/annotate/rdoc_annotater.rbs +82 -0
  82. data/sig/annotate/rdoc_source.rbs +30 -0
  83. data/sig/cli.rbs +2 -0
  84. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  85. data/sig/location.rbs +6 -0
  86. data/sig/method_types.rbs +5 -1
  87. data/sig/polyfill.rbs +78 -0
  88. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  89. data/stdlib/abbrev/0/array.rbs +26 -0
  90. data/stdlib/base64/0/base64.rbs +31 -0
  91. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  92. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  93. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  94. data/stdlib/cgi/0/core.rbs +59 -0
  95. data/stdlib/coverage/0/coverage.rbs +164 -2
  96. data/stdlib/csv/0/csv.rbs +2862 -398
  97. data/stdlib/date/0/date.rbs +483 -25
  98. data/stdlib/date/0/date_time.rbs +187 -12
  99. data/stdlib/dbm/0/dbm.rbs +152 -17
  100. data/stdlib/digest/0/digest.rbs +146 -0
  101. data/stdlib/erb/0/erb.rbs +65 -245
  102. data/stdlib/fiber/0/fiber.rbs +73 -91
  103. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  104. data/stdlib/find/0/find.rbs +9 -0
  105. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  106. data/stdlib/io-console/0/io-console.rbs +227 -15
  107. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  108. data/stdlib/json/0/json.rbs +1146 -144
  109. data/stdlib/logger/0/formatter.rbs +24 -0
  110. data/stdlib/logger/0/log_device.rbs +64 -0
  111. data/stdlib/logger/0/logger.rbs +165 -13
  112. data/stdlib/logger/0/period.rbs +10 -0
  113. data/stdlib/logger/0/severity.rbs +26 -0
  114. data/stdlib/monitor/0/monitor.rbs +163 -0
  115. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  116. data/stdlib/net-http/0/net-http.rbs +1492 -683
  117. data/stdlib/nkf/0/nkf.rbs +372 -0
  118. data/stdlib/objspace/0/objspace.rbs +149 -90
  119. data/stdlib/openssl/0/openssl.rbs +8108 -71
  120. data/stdlib/optparse/0/optparse.rbs +487 -19
  121. data/stdlib/pathname/0/pathname.rbs +425 -124
  122. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  123. data/stdlib/prime/0/integer-extension.rbs +20 -2
  124. data/stdlib/prime/0/prime.rbs +88 -21
  125. data/stdlib/pstore/0/pstore.rbs +102 -0
  126. data/stdlib/pty/0/pty.rbs +64 -14
  127. data/stdlib/resolv/0/resolv.rbs +420 -31
  128. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  129. data/stdlib/rubygems/0/config_file.rbs +33 -1
  130. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  131. data/stdlib/rubygems/0/installer.rbs +13 -1
  132. data/stdlib/rubygems/0/path_support.rbs +4 -1
  133. data/stdlib/rubygems/0/platform.rbs +5 -1
  134. data/stdlib/rubygems/0/request_set.rbs +44 -2
  135. data/stdlib/rubygems/0/requirement.rbs +65 -2
  136. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  137. data/stdlib/rubygems/0/source_list.rbs +13 -0
  138. data/stdlib/rubygems/0/specification.rbs +21 -1
  139. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  140. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  141. data/stdlib/rubygems/0/version.rbs +60 -157
  142. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  143. data/stdlib/set/0/set.rbs +420 -106
  144. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  145. data/stdlib/singleton/0/singleton.rbs +20 -0
  146. data/stdlib/socket/0/addrinfo.rbs +210 -9
  147. data/stdlib/socket/0/basic_socket.rbs +103 -11
  148. data/stdlib/socket/0/ip_socket.rbs +31 -9
  149. data/stdlib/socket/0/socket.rbs +586 -38
  150. data/stdlib/socket/0/tcp_server.rbs +22 -2
  151. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  152. data/stdlib/socket/0/udp_socket.rbs +25 -2
  153. data/stdlib/socket/0/unix_server.rbs +22 -2
  154. data/stdlib/socket/0/unix_socket.rbs +45 -5
  155. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  156. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  157. data/stdlib/time/0/time.rbs +208 -116
  158. data/stdlib/timeout/0/timeout.rbs +10 -0
  159. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  160. data/stdlib/tsort/0/cyclic.rbs +1 -0
  161. data/stdlib/tsort/0/interfaces.rbs +1 -0
  162. data/stdlib/tsort/0/tsort.rbs +42 -0
  163. data/stdlib/uri/0/common.rbs +57 -8
  164. data/stdlib/uri/0/file.rbs +55 -109
  165. data/stdlib/uri/0/ftp.rbs +6 -3
  166. data/stdlib/uri/0/generic.rbs +556 -327
  167. data/stdlib/uri/0/http.rbs +26 -115
  168. data/stdlib/uri/0/https.rbs +8 -102
  169. data/stdlib/uri/0/ldap.rbs +143 -137
  170. data/stdlib/uri/0/ldaps.rbs +8 -102
  171. data/stdlib/uri/0/mailto.rbs +3 -0
  172. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  173. data/stdlib/uri/0/ws.rbs +6 -3
  174. data/stdlib/uri/0/wss.rbs +5 -3
  175. data/stdlib/yaml/0/dbm.rbs +151 -87
  176. data/stdlib/yaml/0/store.rbs +6 -0
  177. data/stdlib/zlib/0/zlib.rbs +90 -31
  178. metadata +17 -5
  179. data/lib/rbs/location.rb +0 -221
@@ -1,5 +1,10 @@
1
+ # <!-- rdoc-file=lib/optparse.rb -->
1
2
  # ## OptionParser
2
3
  #
4
+ # ### New to OptionParser?
5
+ #
6
+ # See the [Tutorial](./doc/optparse/tutorial_rdoc.html).
7
+ #
3
8
  # ### Introduction
4
9
  #
5
10
  # OptionParser is a class for command-line option analysis. It is much more
@@ -368,8 +373,11 @@
368
373
  #
369
374
  # ### Further documentation
370
375
  #
371
- # The above examples should be enough to learn how to use this class. If you
372
- # have any questions, file a ticket at http://bugs.ruby-lang.org.
376
+ # The above examples, along with the accompanying
377
+ # [Tutorial](./doc/optparse/tutorial_rdoc.html), should be enough to learn how
378
+ # to use this class. If you have any questions, file a ticket at
379
+ # http://bugs.ruby-lang.org.
380
+ #
373
381
  class OptionParser
374
382
  interface _Pattern
375
383
  def match: (untyped other) -> boolish
@@ -383,27 +391,57 @@ class OptionParser
383
391
  def <<: (String) -> untyped
384
392
  end
385
393
 
394
+ # <!--
395
+ # rdoc-file=lib/optparse.rb
396
+ # - accept(*args, &blk)
397
+ # -->
386
398
  # See #accept.
387
399
  #
388
400
  def self.accept: (Class t, ?_Pattern pat) ?{ (*untyped) -> untyped } -> void
389
401
 
402
+ # <!--
403
+ # rdoc-file=lib/optparse.rb
404
+ # - getopts(*args)
405
+ # -->
390
406
  # See #getopts.
391
407
  #
392
408
  def self.getopts: (*String options) -> Hash[String, untyped]
393
409
  | (Array[String] args, *String options) -> Hash[String, untyped]
394
410
 
411
+ # <!--
412
+ # rdoc-file=lib/optparse.rb
413
+ # - inc(arg, default = nil)
414
+ # -->
395
415
  # Returns an incremented value of `default` according to `arg`.
396
416
  #
397
417
  def self.inc: (untyped arg, ?_ToI default) -> Integer?
398
418
 
419
+ # <!--
420
+ # rdoc-file=lib/optparse.rb
421
+ # - reject(*args, &blk)
422
+ # -->
399
423
  # See #reject.
400
424
  #
401
425
  def self.reject: (Class t) -> void
402
426
 
427
+ # <!--
428
+ # rdoc-file=lib/optparse.rb
429
+ # - terminate(arg = nil)
430
+ # -->
431
+ #
403
432
  def self.terminate: (?String arg) -> bot
404
433
 
434
+ # <!--
435
+ # rdoc-file=lib/optparse.rb
436
+ # - top()
437
+ # -->
438
+ #
405
439
  def self.top: () -> OptionParser::List
406
440
 
441
+ # <!--
442
+ # rdoc-file=lib/optparse.rb
443
+ # - with(*args, &block)
444
+ # -->
407
445
  # Initializes a new instance and evaluates the optional block in context of the
408
446
  # instance. Arguments `args` are passed to #new, see there for description of
409
447
  # parameters.
@@ -415,8 +453,17 @@ class OptionParser
415
453
 
416
454
  public
417
455
 
456
+ # <!--
457
+ # rdoc-file=lib/optparse.rb
458
+ # - abort(mesg = $!)
459
+ # -->
460
+ #
418
461
  def abort: (?_ToS mesg) -> bot
419
462
 
463
+ # <!--
464
+ # rdoc-file=lib/optparse.rb
465
+ # - accept(*args, &blk)
466
+ # -->
420
467
  # Directs to accept specified class `t`. The argument string is passed to the
421
468
  # block in which it should be converted to the desired class.
422
469
  #
@@ -432,34 +479,68 @@ class OptionParser
432
479
 
433
480
  def add_officious: () -> void
434
481
 
482
+ # <!--
483
+ # rdoc-file=lib/optparse.rb
484
+ # - additional_message(typ, opt)
485
+ # -->
435
486
  # Returns additional info.
436
487
  #
437
488
  def additional_message: (untyped typ, untyped opt) -> String?
438
489
 
490
+ # <!-- rdoc-file=lib/optparse.rb -->
439
491
  # Heading banner preceding summary.
440
492
  #
441
493
  attr_accessor banner: String
442
494
 
495
+ # <!--
496
+ # rdoc-file=lib/optparse.rb
497
+ # - base()
498
+ # -->
443
499
  # Subject of #on_tail.
444
500
  #
445
501
  def base: () -> List
446
502
 
503
+ # <!--
504
+ # rdoc-file=lib/optparse.rb
505
+ # - candidate(word)
506
+ # -->
507
+ #
447
508
  def candidate: (String word) -> Array[untyped]
448
509
 
449
510
  def compsys: (untyped to, ?untyped name) -> untyped
450
511
 
512
+ # <!--
513
+ # rdoc-file=lib/optparse.rb
514
+ # - def_head_option(*opts, &block)
515
+ # -->
516
+ #
451
517
  alias def_head_option define_head
452
518
 
519
+ # <!--
520
+ # rdoc-file=lib/optparse.rb
521
+ # - def_option(*opts, &block)
522
+ # -->
523
+ #
453
524
  alias def_option define
454
525
 
526
+ # <!--
527
+ # rdoc-file=lib/optparse.rb
528
+ # - def_tail_option(*opts, &block)
529
+ # -->
530
+ #
455
531
  alias def_tail_option define_tail
456
532
 
533
+ # <!-- rdoc-file=lib/optparse.rb -->
457
534
  # Strings to be parsed in default.
458
535
  #
459
536
  attr_accessor default_argv: Array[String]
460
537
 
538
+ # <!--
539
+ # rdoc-file=lib/optparse.rb
540
+ # - define(*params, &block)
541
+ # -->
461
542
  # Creates an option from the given parameters `params`. See [Parameters for New
462
- # Options](./option_params_rdoc.html).
543
+ # Options](./doc/optparse/option_params_rdoc.html).
463
544
  #
464
545
  # The block, if given, is the handler for the created option. When the option is
465
546
  # encountered during command-line parsing, the block is called with the argument
@@ -471,8 +552,12 @@ class OptionParser
471
552
  | (*String params, Proc | Method handler) -> untyped
472
553
  | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> untyped
473
554
 
555
+ # <!--
556
+ # rdoc-file=lib/optparse.rb
557
+ # - define_head(*params, &block)
558
+ # -->
474
559
  # Creates an option from the given parameters `params`. See [Parameters for New
475
- # Options](./option_params_rdoc.html).
560
+ # Options](./doc/optparse/option_params_rdoc.html).
476
561
  #
477
562
  # The block, if given, is the handler for the created option. When the option is
478
563
  # encountered during command-line parsing, the block is called with the argument
@@ -484,8 +569,12 @@ class OptionParser
484
569
  | (*String params, Proc | Method handler) -> untyped
485
570
  | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> untyped
486
571
 
572
+ # <!--
573
+ # rdoc-file=lib/optparse.rb
574
+ # - define_tail(*params, &block)
575
+ # -->
487
576
  # Creates an option from the given parameters `params`. See [Parameters for New
488
- # Options](./option_params_rdoc.html).
577
+ # Options](./doc/optparse/option_params_rdoc.html).
489
578
  #
490
579
  # The block, if given, is the handler for the created option. When the option is
491
580
  # encountered during command-line parsing, the block is called with the argument
@@ -497,6 +586,10 @@ class OptionParser
497
586
  | (*String params, Proc | Method handler) -> untyped
498
587
  | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> untyped
499
588
 
589
+ # <!--
590
+ # rdoc-file=lib/optparse.rb
591
+ # - environment(env = File.basename($0, '.*'))
592
+ # -->
500
593
  # Parses environment variable `env` or its uppercase with splitting like a
501
594
  # shell.
502
595
  #
@@ -504,6 +597,10 @@ class OptionParser
504
597
  #
505
598
  def environment: (?String env) -> Array[String]?
506
599
 
600
+ # <!--
601
+ # rdoc-file=lib/optparse.rb
602
+ # - getopts(*args)
603
+ # -->
507
604
  # Wrapper method for getopts.rb.
508
605
  #
509
606
  # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option")
@@ -514,14 +611,27 @@ class OptionParser
514
611
  # # params["zot"] = "z" # --zot Z
515
612
  #
516
613
  def getopts: (*String options) -> Hash[String, untyped]
517
- | (Array[String] args, *String options) -> Hash[String, untyped]
614
+ | (Array[String] args, *String options) -> Hash[String, untyped]
518
615
 
616
+ # <!--
617
+ # rdoc-file=lib/optparse.rb
618
+ # - help()
619
+ # -->
519
620
  # Returns option summary string.
520
621
  #
521
622
  def help: () -> String
522
623
 
624
+ # <!--
625
+ # rdoc-file=lib/optparse.rb
626
+ # - inc(*args)
627
+ # -->
628
+ #
523
629
  def inc: (*untyped args) -> untyped
524
630
 
631
+ # <!--
632
+ # rdoc-file=lib/optparse.rb
633
+ # - load(filename = nil)
634
+ # -->
525
635
  # Loads options from file names as `filename`. Does nothing when the file is not
526
636
  # present. Returns whether successfully loaded.
527
637
  #
@@ -531,23 +641,35 @@ class OptionParser
531
641
  #
532
642
  def load: (?String filename) -> bool
533
643
 
644
+ # <!--
645
+ # rdoc-file=lib/optparse.rb
646
+ # - make_switch(params, block = nil)
647
+ # -->
534
648
  # Creates an option from the given parameters `params`. See [Parameters for New
535
- # Options](./option_params_rdoc.html).
649
+ # Options](./doc/optparse/option_params_rdoc.html).
536
650
  #
537
651
  # The block, if given, is the handler for the created option. When the option is
538
652
  # encountered during command-line parsing, the block is called with the argument
539
653
  # given for the option, if any. See [Option
540
654
  # Handlers](./option_params_rdoc.html#label-Option+Handlers).
541
655
  #
542
- def make_switch: (Array[untyped] opts, ?Proc block) -> [untyped, untyped, untyped, untyped, untyped]
656
+ def make_switch: (Array[untyped] opts, ?Proc block) -> [ untyped, untyped, untyped, untyped, untyped ]
543
657
 
658
+ # <!--
659
+ # rdoc-file=lib/optparse.rb
660
+ # - new() { |self| ... }
661
+ # -->
544
662
  # Pushes a new List.
545
663
  #
546
664
  def new: () -> self
547
665
  | [T] () { (self) -> T } -> T
548
666
 
667
+ # <!--
668
+ # rdoc-file=lib/optparse.rb
669
+ # - on(*params, &block)
670
+ # -->
549
671
  # Creates an option from the given parameters `params`. See [Parameters for New
550
- # Options](./option_params_rdoc.html).
672
+ # Options](./doc/optparse/option_params_rdoc.html).
551
673
  #
552
674
  # The block, if given, is the handler for the created option. When the option is
553
675
  # encountered during command-line parsing, the block is called with the argument
@@ -559,9 +681,12 @@ class OptionParser
559
681
  | (*String params, Proc | Method handler) -> self
560
682
  | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
561
683
 
562
-
684
+ # <!--
685
+ # rdoc-file=lib/optparse.rb
686
+ # - on_head(*params, &block)
687
+ # -->
563
688
  # Creates an option from the given parameters `params`. See [Parameters for New
564
- # Options](./option_params_rdoc.html).
689
+ # Options](./doc/optparse/option_params_rdoc.html).
565
690
  #
566
691
  # The block, if given, is the handler for the created option. When the option is
567
692
  # encountered during command-line parsing, the block is called with the argument
@@ -575,8 +700,12 @@ class OptionParser
575
700
  | (*String params, Proc | Method handler) -> self
576
701
  | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
577
702
 
703
+ # <!--
704
+ # rdoc-file=lib/optparse.rb
705
+ # - on_tail(*params, &block)
706
+ # -->
578
707
  # Creates an option from the given parameters `params`. See [Parameters for New
579
- # Options](./option_params_rdoc.html).
708
+ # Options](./doc/optparse/option_params_rdoc.html).
580
709
  #
581
710
  # The block, if given, is the handler for the created option. When the option is
582
711
  # encountered during command-line parsing, the block is called with the argument
@@ -590,6 +719,10 @@ class OptionParser
590
719
  | (*String params, Proc | Method handler) -> self
591
720
  | (String params, Class | Array[String] | Hash[Symbol, untyped] | Regexp obj, ?String desc, Proc | Method handler) -> self
592
721
 
722
+ # <!--
723
+ # rdoc-file=lib/optparse.rb
724
+ # - order(*argv, into: nil, &nonopt)
725
+ # -->
593
726
  # Parses command line arguments `argv` in order. When a block is given, each
594
727
  # non-option argument is yielded. When optional `into` keyword argument is
595
728
  # provided, the parsed option values are stored there via `[]=` method (so it
@@ -600,11 +733,19 @@ class OptionParser
600
733
  def order: (*String argv, ?into: _Intoable) ?{ (String) -> void } -> Array[String]
601
734
  | (Array[String] argv, ?into: _Intoable) ?{ (String) -> void } -> Array[String]
602
735
 
736
+ # <!--
737
+ # rdoc-file=lib/optparse.rb
738
+ # - order!(argv = default_argv, into: nil, &nonopt)
739
+ # -->
603
740
  # Same as #order, but removes switches destructively. Non-option arguments
604
741
  # remain in `argv`.
605
742
  #
606
743
  def order!: (?Array[String] argv, ?into: _Intoable) ?{ (String) -> void } -> Array[String]
607
744
 
745
+ # <!--
746
+ # rdoc-file=lib/optparse.rb
747
+ # - parse(*argv, into: nil)
748
+ # -->
608
749
  # Parses command line arguments `argv` in order when environment variable
609
750
  # POSIXLY_CORRECT is set, and in permutation mode otherwise. When optional
610
751
  # `into` keyword argument is provided, the parsed option values are stored there
@@ -613,11 +754,19 @@ class OptionParser
613
754
  def parse: (*String argv, ?into: _Intoable) -> Array[String]
614
755
  | (Array[String] argv, ?into: _Intoable) -> Array[String]
615
756
 
757
+ # <!--
758
+ # rdoc-file=lib/optparse.rb
759
+ # - parse!(argv = default_argv, into: nil)
760
+ # -->
616
761
  # Same as #parse, but removes switches destructively. Non-option arguments
617
762
  # remain in `argv`.
618
763
  #
619
764
  def parse!: (?Array[String] argv, ?into: _Intoable) -> Array[String]
620
765
 
766
+ # <!--
767
+ # rdoc-file=lib/optparse.rb
768
+ # - permute(*argv, into: nil)
769
+ # -->
621
770
  # Parses command line arguments `argv` in permutation mode and returns list of
622
771
  # non-option arguments. When optional `into` keyword argument is provided, the
623
772
  # parsed option values are stored there via `[]=` method (so it can be Hash, or
@@ -626,16 +775,25 @@ class OptionParser
626
775
  def permute: (*String argv, ?into: _Intoable) -> Array[String]
627
776
  | (Array[String] argv, ?into: _Intoable) -> Array[String]
628
777
 
778
+ # <!--
779
+ # rdoc-file=lib/optparse.rb
780
+ # - permute!(argv = default_argv, into: nil)
781
+ # -->
629
782
  # Same as #permute, but removes switches destructively. Non-option arguments
630
783
  # remain in `argv`.
631
784
  #
632
785
  def permute!: (?Array[String] argv, ?into: _Intoable) -> Array[String]
633
786
 
787
+ # <!-- rdoc-file=lib/optparse.rb -->
634
788
  # Program name to be emitted in error message and default banner, defaults to
635
789
  # $0.
636
790
  #
637
791
  attr_accessor program_name: String
638
792
 
793
+ # <!--
794
+ # rdoc-file=lib/optparse.rb
795
+ # - reject(*args, &blk)
796
+ # -->
639
797
  # Directs to reject specified class argument.
640
798
  #
641
799
  # `t`
@@ -646,21 +804,31 @@ class OptionParser
646
804
  #
647
805
  def reject: (Class t) -> void
648
806
 
807
+ # <!-- rdoc-file=lib/optparse.rb -->
649
808
  # Release code
650
809
  #
651
810
  def release: () -> untyped
652
811
 
653
812
  def release=: (untyped) -> untyped
654
813
 
814
+ # <!--
815
+ # rdoc-file=lib/optparse.rb
816
+ # - remove()
817
+ # -->
655
818
  # Removes the last List.
656
819
  #
657
820
  def remove: () -> List?
658
821
 
822
+ # <!-- rdoc-file=lib/optparse.rb -->
659
823
  # Whether to require that options match exactly (disallows providing abbreviated
660
824
  # long option as short option).
661
825
  #
662
826
  attr_accessor require_exact: boolish
663
827
 
828
+ # <!--
829
+ # rdoc-file=lib/optparse.rb
830
+ # - separator(string)
831
+ # -->
664
832
  # Add separator in summary.
665
833
  #
666
834
  def separator: (String string) -> void
@@ -674,14 +842,20 @@ class OptionParser
674
842
  #
675
843
  alias set_program_name program_name=
676
844
 
845
+ # <!-- rdoc-file=lib/optparse.rb -->
677
846
  # Indentation for summary. Must be String (or have + String method).
678
847
  #
679
848
  alias set_summary_indent summary_indent=
680
849
 
850
+ # <!-- rdoc-file=lib/optparse.rb -->
681
851
  # Width for option list portion of summary. Must be Numeric.
682
852
  #
683
853
  alias set_summary_width summary_width=
684
854
 
855
+ # <!--
856
+ # rdoc-file=lib/optparse.rb
857
+ # - summarize(to = [], width = @summary_width, max = width - 1, indent = @summary_indent, &blk)
858
+ # -->
685
859
  # Puts option summary into `to` and returns `to`. Yields each line if a block is
686
860
  # given.
687
861
  #
@@ -694,44 +868,76 @@ class OptionParser
694
868
  # `indent`
695
869
  # : Indentation, defaults to @summary_indent.
696
870
  #
697
- #
698
871
  def summarize: (?_LtLtString to, ?Integer width, ?Integer max, ?String indent) ?{ (String line) -> void } -> _LtLtString
699
872
 
873
+ # <!-- rdoc-file=lib/optparse.rb -->
700
874
  # Indentation for summary. Must be String (or have + String method).
701
875
  #
702
876
  attr_accessor summary_indent: String
703
877
 
878
+ # <!-- rdoc-file=lib/optparse.rb -->
704
879
  # Width for option list portion of summary. Must be Numeric.
705
880
  #
706
881
  attr_accessor summary_width: Integer
707
882
 
883
+ # <!--
884
+ # rdoc-file=lib/optparse.rb
885
+ # - terminate(arg = nil)
886
+ # -->
708
887
  # Terminates option parsing. Optional parameter `arg` is a string pushed back to
709
888
  # be the first non-option argument.
710
889
  #
711
890
  def terminate: (?String arg) -> bot
712
891
 
892
+ # <!--
893
+ # rdoc-file=lib/optparse.rb
894
+ # - to_a()
895
+ # -->
713
896
  # Returns option summary list.
714
897
  #
715
898
  def to_a: () -> Array[String]
716
899
 
900
+ # <!--
901
+ # rdoc-file=lib/optparse.rb
902
+ # - to_s()
903
+ # -->
904
+ #
717
905
  alias to_s help
718
906
 
907
+ # <!--
908
+ # rdoc-file=lib/optparse.rb
909
+ # - top()
910
+ # -->
719
911
  # Subject of #on / #on_head, #accept / #reject
720
912
  #
721
913
  def top: () -> List
722
914
 
915
+ # <!--
916
+ # rdoc-file=lib/optparse.rb
917
+ # - ver()
918
+ # -->
723
919
  # Returns version string from program_name, version and release.
724
920
  #
725
921
  def ver: () -> String?
726
922
 
923
+ # <!-- rdoc-file=lib/optparse.rb -->
727
924
  # Version
728
925
  #
729
926
  attr_accessor version: String?
730
927
 
928
+ # <!--
929
+ # rdoc-file=lib/optparse.rb
930
+ # - warn(mesg = $!)
931
+ # -->
932
+ #
731
933
  def warn: (?_ToS mesg) -> void
732
934
 
733
935
  private
734
936
 
937
+ # <!--
938
+ # rdoc-file=lib/optparse.rb
939
+ # - complete(typ, opt, icase = false, *pat)
940
+ # -->
735
941
  # Completes shortened long style option switch and returns pair of canonical
736
942
  # switch and switch descriptor OptionParser::Switch.
737
943
  #
@@ -744,9 +950,12 @@ class OptionParser
744
950
  # `pat`
745
951
  # : Optional pattern for completion.
746
952
  #
747
- #
748
953
  def complete: (untyped typ, untyped opt, ?untyped icase, *untyped pat) -> untyped
749
954
 
955
+ # <!--
956
+ # rdoc-file=lib/optparse.rb
957
+ # - new(banner = nil, width = 32, indent = ' ' * 4) { |self| ... }
958
+ # -->
750
959
  # Initializes the instance and yields itself if called with a block.
751
960
  #
752
961
  # `banner`
@@ -756,9 +965,12 @@ class OptionParser
756
965
  # `indent`
757
966
  # : Summary indent.
758
967
  #
759
- #
760
968
  def initialize: (?String banner, ?Integer width, ?String indent) ?{ (OptionParser) -> void } -> void
761
969
 
970
+ # <!--
971
+ # rdoc-file=lib/optparse.rb
972
+ # - notwice(obj, prv, msg)
973
+ # -->
762
974
  # Checks if an argument is given twice, in which case an ArgumentError is
763
975
  # raised. Called from OptionParser#switch only.
764
976
  #
@@ -769,15 +981,22 @@ class OptionParser
769
981
  # `msg`
770
982
  # : Exception message.
771
983
  #
772
- #
773
984
  def notwice: (untyped obj, untyped prv, untyped msg) -> untyped
774
985
 
775
986
  def parse_in_order: (?untyped argv, ?untyped setter) { (*untyped) -> untyped } -> untyped
776
987
 
988
+ # <!--
989
+ # rdoc-file=lib/optparse.rb
990
+ # - search(id, key) { |k| ... }
991
+ # -->
777
992
  # Searches `key` in @stack for `id` hash and returns or yields the result.
778
993
  #
779
994
  def search: (untyped id, untyped key) -> untyped
780
995
 
996
+ # <!--
997
+ # rdoc-file=lib/optparse.rb
998
+ # - visit(id, *args, &block)
999
+ # -->
781
1000
  # Traverses @stack, sending each element method `id` with `args` and `block`.
782
1001
  #
783
1002
  def visit: (untyped id, *untyped args) { (*untyped) -> untyped } -> untyped
@@ -787,23 +1006,29 @@ OptionParser::ArgumentStyle: Hash[untyped, untyped]
787
1006
 
788
1007
  OptionParser::COMPSYS_HEADER: String
789
1008
 
1009
+ # <!-- rdoc-file=lib/optparse.rb -->
790
1010
  # Decimal integer format, to be converted to Integer.
1011
+ #
791
1012
  OptionParser::DecimalInteger: Regexp
792
1013
 
1014
+ # <!-- rdoc-file=lib/optparse.rb -->
793
1015
  # Decimal integer/float number format, to be converted to Integer for integer
794
1016
  # format, Float for float format.
1017
+ #
795
1018
  OptionParser::DecimalNumeric: Regexp
796
1019
 
797
1020
  OptionParser::DefaultList: OptionParser::List
798
1021
 
799
1022
  OptionParser::NO_ARGUMENT: Symbol
800
1023
 
801
- OptionParser::NoArgument: [:NONE, nil]
1024
+ OptionParser::NoArgument: [ :NONE, nil ]
802
1025
 
803
1026
  OptionParser::OPTIONAL_ARGUMENT: Symbol
804
1027
 
1028
+ # <!-- rdoc-file=lib/optparse.rb -->
805
1029
  # Ruby/C like octal/hexadecimal/binary integer format, to be converted to
806
1030
  # Integer.
1031
+ #
807
1032
  OptionParser::OctalInteger: Regexp
808
1033
 
809
1034
  OptionParser::Officious: Hash[untyped, untyped]
@@ -818,8 +1043,10 @@ OptionParser::SPLAT_PROC: Proc
818
1043
 
819
1044
  OptionParser::Version: String
820
1045
 
1046
+ # <!-- rdoc-file=lib/optparse.rb -->
821
1047
  # Acceptable argument classes. Now contains DecimalInteger, OctalInteger and
822
1048
  # DecimalNumeric. See Acceptable argument classes (in source code).
1049
+ #
823
1050
  module OptionParser::Acceptables
824
1051
  end
825
1052
 
@@ -829,26 +1056,40 @@ OptionParser::Acceptables::DecimalNumeric: Regexp
829
1056
 
830
1057
  OptionParser::Acceptables::OctalInteger: Regexp
831
1058
 
1059
+ # <!-- rdoc-file=lib/optparse.rb -->
832
1060
  # Raises when the given argument word can't be completed uniquely.
1061
+ #
833
1062
  class OptionParser::AmbiguousArgument < OptionParser::InvalidArgument
834
1063
  end
835
1064
 
836
1065
  OptionParser::AmbiguousArgument::Reason: String
837
1066
 
1067
+ # <!-- rdoc-file=lib/optparse.rb -->
838
1068
  # Raises when ambiguously completable string is encountered.
1069
+ #
839
1070
  class OptionParser::AmbiguousOption < OptionParser::ParseError
840
1071
  end
841
1072
 
842
1073
  OptionParser::AmbiguousOption::Reason: String
843
1074
 
1075
+ # <!-- rdoc-file=lib/optparse.rb -->
844
1076
  # Extends command line arguments array (ARGV) to parse itself.
1077
+ #
845
1078
  module OptionParser::Arguable
1079
+ # <!--
1080
+ # rdoc-file=lib/optparse.rb
1081
+ # - extend_object(obj)
1082
+ # -->
846
1083
  # Initializes instance variable.
847
1084
  #
848
1085
  def self.extend_object: (untyped obj) -> untyped
849
1086
 
850
1087
  public
851
1088
 
1089
+ # <!--
1090
+ # rdoc-file=lib/optparse.rb
1091
+ # - getopts(*args)
1092
+ # -->
852
1093
  # Substitution of getopts is possible as follows. Also see OptionParser#getopts.
853
1094
  #
854
1095
  # def getopts(*args)
@@ -860,6 +1101,10 @@ module OptionParser::Arguable
860
1101
  #
861
1102
  def getopts: (*String args) -> Hash[String, untyped]
862
1103
 
1104
+ # <!--
1105
+ # rdoc-file=lib/optparse.rb
1106
+ # - options() { |optparse| ... }
1107
+ # -->
863
1108
  # Actual OptionParser object, automatically created if nonexistent.
864
1109
  #
865
1110
  # If called with a block, yields the OptionParser object and returns the result
@@ -869,6 +1114,10 @@ module OptionParser::Arguable
869
1114
  def options: () -> OptionParser
870
1115
  | [T] () { (OptionParser) -> T } -> T?
871
1116
 
1117
+ # <!--
1118
+ # rdoc-file=lib/optparse.rb
1119
+ # - options=(opt)
1120
+ # -->
872
1121
  # Sets OptionParser object, when `opt` is `false` or `nil`, methods
873
1122
  # OptionParser::Arguable#options and OptionParser::Arguable#options= are
874
1123
  # undefined. Thus, there is no ways to access the OptionParser object via the
@@ -876,73 +1125,132 @@ module OptionParser::Arguable
876
1125
  #
877
1126
  def options=: (OptionParser? opt) -> untyped
878
1127
 
1128
+ # <!--
1129
+ # rdoc-file=lib/optparse.rb
1130
+ # - order!(&blk)
1131
+ # -->
879
1132
  # Parses `self` destructively in order and returns `self` containing the rest
880
1133
  # arguments left unparsed.
881
1134
  #
882
1135
  def order!: () ?{ (String) -> void } -> Array[String]
883
1136
 
1137
+ # <!--
1138
+ # rdoc-file=lib/optparse.rb
1139
+ # - parse!()
1140
+ # -->
884
1141
  # Parses `self` destructively and returns `self` containing the rest arguments
885
1142
  # left unparsed.
886
1143
  #
887
1144
  def parse!: () -> Array[String]
888
1145
 
1146
+ # <!--
1147
+ # rdoc-file=lib/optparse.rb
1148
+ # - permute!()
1149
+ # -->
889
1150
  # Parses `self` destructively in permutation mode and returns `self` containing
890
1151
  # the rest arguments left unparsed.
891
1152
  #
892
1153
  def permute!: () -> Array[String]
893
1154
  end
894
1155
 
1156
+ # <!-- rdoc-file=lib/optparse.rb -->
895
1157
  # Hash with completion search feature. See OptionParser::Completion.
1158
+ #
896
1159
  class OptionParser::CompletingHash < Hash[untyped, untyped]
897
1160
  include OptionParser::Completion
898
1161
 
899
1162
  public
900
1163
 
1164
+ # <!--
1165
+ # rdoc-file=lib/optparse.rb
1166
+ # - match(key)
1167
+ # -->
901
1168
  # Completion for hash key.
902
1169
  #
903
1170
  def match: (untyped key) -> untyped
904
1171
  end
905
1172
 
1173
+ # <!-- rdoc-file=lib/optparse.rb -->
906
1174
  # Keyword completion module. This allows partial arguments to be specified and
907
1175
  # resolved against a list of acceptable values.
1176
+ #
908
1177
  module OptionParser::Completion
1178
+ # <!--
1179
+ # rdoc-file=lib/optparse.rb
1180
+ # - candidate(key, icase = false, pat = nil, &block)
1181
+ # -->
1182
+ #
909
1183
  def self.candidate: (untyped key, ?untyped icase, ?untyped pat) { (*untyped) -> untyped } -> untyped
910
1184
 
1185
+ # <!--
1186
+ # rdoc-file=lib/optparse.rb
1187
+ # - regexp(key, icase)
1188
+ # -->
1189
+ #
911
1190
  def self.regexp: (untyped key, untyped icase) -> untyped
912
1191
 
913
1192
  public
914
1193
 
1194
+ # <!--
1195
+ # rdoc-file=lib/optparse.rb
1196
+ # - candidate(key, icase = false, pat = nil)
1197
+ # -->
1198
+ #
915
1199
  def candidate: (untyped key, ?untyped icase, ?untyped pat) -> untyped
916
1200
 
1201
+ # <!--
1202
+ # rdoc-file=lib/optparse.rb
1203
+ # - complete(key, icase = false, pat = nil) { |key, *sw| ... }
1204
+ # -->
1205
+ #
917
1206
  def complete: (untyped key, ?untyped icase, ?untyped pat) -> untyped
918
1207
 
1208
+ # <!--
1209
+ # rdoc-file=lib/optparse.rb
1210
+ # - convert(opt = nil, val = nil, *)
1211
+ # -->
1212
+ #
919
1213
  def convert: (?untyped opt, ?untyped val, *untyped) -> untyped
920
1214
  end
921
1215
 
1216
+ # <!-- rdoc-file=lib/optparse.rb -->
922
1217
  # Raises when the given argument does not match required format.
1218
+ #
923
1219
  class OptionParser::InvalidArgument < OptionParser::ParseError
924
1220
  end
925
1221
 
926
1222
  OptionParser::InvalidArgument::Reason: String
927
1223
 
1224
+ # <!-- rdoc-file=lib/optparse.rb -->
928
1225
  # Raises when switch is undefined.
1226
+ #
929
1227
  class OptionParser::InvalidOption < OptionParser::ParseError
930
1228
  end
931
1229
 
932
1230
  OptionParser::InvalidOption::Reason: String
933
1231
 
1232
+ # <!-- rdoc-file=lib/optparse.rb -->
934
1233
  # Simple option list providing mapping from short and/or long option string to
935
1234
  # OptionParser::Switch and mapping from acceptable argument to matching pattern
936
1235
  # and converter pair. Also provides summary feature.
1236
+ #
937
1237
  class OptionParser::List
938
1238
  public
939
1239
 
1240
+ # <!--
1241
+ # rdoc-file=lib/optparse.rb
1242
+ # - accept(t, pat = /.*/m, &block)
1243
+ # -->
940
1244
  # See OptionParser.accept.
941
1245
  #
942
1246
  def accept: (untyped t, ?untyped pat) { (*untyped) -> untyped } -> untyped
943
1247
 
944
1248
  def add_banner: (untyped to) -> untyped
945
1249
 
1250
+ # <!--
1251
+ # rdoc-file=lib/optparse.rb
1252
+ # - append(*args)
1253
+ # -->
946
1254
  # Appends `switch` at the tail of the list, and associates short, long and
947
1255
  # negated long options. Arguments are:
948
1256
  #
@@ -960,10 +1268,15 @@ class OptionParser::List
960
1268
  #
961
1269
  def append: (*untyped args) -> untyped
962
1270
 
1271
+ # <!-- rdoc-file=lib/optparse.rb -->
963
1272
  # Map from acceptable argument types to pattern and converter pairs.
964
1273
  #
965
1274
  def atype: () -> untyped
966
1275
 
1276
+ # <!--
1277
+ # rdoc-file=lib/optparse.rb
1278
+ # - complete(id, opt, icase = false, *pat, &block)
1279
+ # -->
967
1280
  # Searches list `id` for `opt` and the optional patterns for completion `pat`.
968
1281
  # If `icase` is true, the search is case insensitive. The result is returned or
969
1282
  # yielded if a block is given. If it isn't found, nil is returned.
@@ -972,20 +1285,35 @@ class OptionParser::List
972
1285
 
973
1286
  def compsys: (*untyped args) { (*untyped) -> untyped } -> untyped
974
1287
 
1288
+ # <!--
1289
+ # rdoc-file=lib/optparse.rb
1290
+ # - each_option(&block)
1291
+ # -->
975
1292
  # Iterates over each option, passing the option to the `block`.
976
1293
  #
977
1294
  def each_option: () { (*untyped) -> untyped } -> untyped
978
1295
 
1296
+ # <!--
1297
+ # rdoc-file=lib/optparse.rb
1298
+ # - get_candidates(id) { |__send__(id).keys| ... }
1299
+ # -->
1300
+ #
979
1301
  def get_candidates: (untyped id) -> untyped
980
1302
 
1303
+ # <!-- rdoc-file=lib/optparse.rb -->
981
1304
  # List of all switches and summary string.
982
1305
  #
983
1306
  def list: () -> untyped
984
1307
 
1308
+ # <!-- rdoc-file=lib/optparse.rb -->
985
1309
  # Map from long style option switches to actual switch objects.
986
1310
  #
987
1311
  def long: () -> untyped
988
1312
 
1313
+ # <!--
1314
+ # rdoc-file=lib/optparse.rb
1315
+ # - prepend(*args)
1316
+ # -->
989
1317
  # Inserts `switch` at the head of the list, and associates short, long and
990
1318
  # negated long options. Arguments are:
991
1319
  #
@@ -1003,19 +1331,32 @@ class OptionParser::List
1003
1331
  #
1004
1332
  def prepend: (*untyped args) -> untyped
1005
1333
 
1334
+ # <!--
1335
+ # rdoc-file=lib/optparse.rb
1336
+ # - reject(t)
1337
+ # -->
1006
1338
  # See OptionParser.reject.
1007
1339
  #
1008
1340
  def reject: (untyped t) -> untyped
1009
1341
 
1342
+ # <!--
1343
+ # rdoc-file=lib/optparse.rb
1344
+ # - search(id, key) { |val| ... }
1345
+ # -->
1010
1346
  # Searches `key` in `id` list. The result is returned or yielded if a block is
1011
1347
  # given. If it isn't found, nil is returned.
1012
1348
  #
1013
1349
  def search: (untyped id, untyped key) -> untyped
1014
1350
 
1351
+ # <!-- rdoc-file=lib/optparse.rb -->
1015
1352
  # Map from short style option switches to actual switch objects.
1016
1353
  #
1017
1354
  def short: () -> untyped
1018
1355
 
1356
+ # <!--
1357
+ # rdoc-file=lib/optparse.rb
1358
+ # - summarize(*args, &block)
1359
+ # -->
1019
1360
  # Creates the summary table, passing each line to the `block` (without newline).
1020
1361
  # The arguments `args` are passed along to the summarize method which is called
1021
1362
  # on every option.
@@ -1024,10 +1365,18 @@ class OptionParser::List
1024
1365
 
1025
1366
  private
1026
1367
 
1368
+ # <!--
1369
+ # rdoc-file=lib/optparse.rb
1370
+ # - new()
1371
+ # -->
1027
1372
  # Just initializes all instance variables.
1028
1373
  #
1029
1374
  def initialize: () -> void
1030
1375
 
1376
+ # <!--
1377
+ # rdoc-file=lib/optparse.rb
1378
+ # - update(sw, sopts, lopts, nsw = nil, nlopts = nil)
1379
+ # -->
1031
1380
  # Adds `sw` according to `sopts`, `lopts` and `nlopts`.
1032
1381
  #
1033
1382
  # `sw`
@@ -1039,29 +1388,41 @@ class OptionParser::List
1039
1388
  # `nlopts`
1040
1389
  # : Negated long style options list.
1041
1390
  #
1042
- #
1043
1391
  def update: (untyped sw, untyped sopts, untyped lopts, ?untyped nsw, ?untyped nlopts) -> untyped
1044
1392
  end
1045
1393
 
1394
+ # <!-- rdoc-file=lib/optparse.rb -->
1046
1395
  # Raises when a switch with mandatory argument has no argument.
1396
+ #
1047
1397
  class OptionParser::MissingArgument < OptionParser::ParseError
1048
1398
  end
1049
1399
 
1050
1400
  OptionParser::MissingArgument::Reason: String
1051
1401
 
1402
+ # <!-- rdoc-file=lib/optparse.rb -->
1052
1403
  # Raises when there is an argument for a switch which takes no argument.
1404
+ #
1053
1405
  class OptionParser::NeedlessArgument < OptionParser::ParseError
1054
1406
  end
1055
1407
 
1056
1408
  OptionParser::NeedlessArgument::Reason: String
1057
1409
 
1410
+ # <!-- rdoc-file=lib/optparse.rb -->
1058
1411
  # Map from option/keyword string to object with completion.
1412
+ #
1059
1413
  class OptionParser::OptionMap < Hash[untyped, untyped]
1060
1414
  include OptionParser::Completion
1061
1415
  end
1062
1416
 
1417
+ # <!-- rdoc-file=lib/optparse.rb -->
1063
1418
  # Base class of exceptions from OptionParser.
1419
+ #
1064
1420
  class OptionParser::ParseError < RuntimeError
1421
+ # <!--
1422
+ # rdoc-file=lib/optparse.rb
1423
+ # - filter_backtrace(array)
1424
+ # -->
1425
+ #
1065
1426
  def self.filter_backtrace: (untyped array) -> untyped
1066
1427
 
1067
1428
  public
@@ -1072,46 +1433,99 @@ class OptionParser::ParseError < RuntimeError
1072
1433
 
1073
1434
  def args: () -> untyped
1074
1435
 
1436
+ # <!--
1437
+ # rdoc-file=lib/optparse.rb
1438
+ # - inspect()
1439
+ # -->
1440
+ #
1075
1441
  def inspect: () -> untyped
1076
1442
 
1443
+ # <!--
1444
+ # rdoc-file=lib/optparse.rb
1445
+ # - message()
1446
+ # -->
1077
1447
  # Default stringizing method to emit standard error message.
1078
1448
  #
1079
1449
  def message: () -> String
1080
1450
 
1451
+ # <!-- rdoc-file=lib/optparse.rb -->
1452
+ #
1081
1453
  def reason: () -> untyped
1082
1454
 
1083
1455
  def reason=: (untyped) -> untyped
1084
1456
 
1457
+ # <!--
1458
+ # rdoc-file=lib/optparse.rb
1459
+ # - recover(argv)
1460
+ # -->
1085
1461
  # Pushes back erred argument(s) to `argv`.
1086
1462
  #
1087
1463
  def recover: (untyped argv) -> untyped
1088
1464
 
1465
+ # <!--
1466
+ # rdoc-file=lib/optparse.rb
1467
+ # - set_backtrace(array)
1468
+ # -->
1469
+ #
1089
1470
  def set_backtrace: (untyped array) -> untyped
1090
1471
 
1472
+ # <!--
1473
+ # rdoc-file=lib/optparse.rb
1474
+ # - set_option(opt, eq)
1475
+ # -->
1476
+ #
1091
1477
  def set_option: (untyped opt, untyped eq) -> untyped
1092
1478
 
1479
+ # <!--
1480
+ # rdoc-file=lib/optparse.rb
1481
+ # - to_s()
1482
+ # -->
1483
+ #
1093
1484
  alias to_s message
1094
1485
 
1095
1486
  private
1096
1487
 
1488
+ # <!--
1489
+ # rdoc-file=lib/optparse.rb
1490
+ # - new(*args, additional: nil)
1491
+ # -->
1492
+ #
1097
1493
  def initialize: (*untyped args, ?additional: untyped) -> void
1098
1494
  end
1099
1495
 
1496
+ # <!-- rdoc-file=lib/optparse.rb -->
1100
1497
  # Reason which caused the error.
1498
+ #
1101
1499
  OptionParser::ParseError::Reason: String
1102
1500
 
1501
+ # <!-- rdoc-file=lib/optparse.rb -->
1103
1502
  # Individual switch class. Not important to the user.
1104
1503
  #
1105
1504
  # Defined within Switch are several Switch-derived classes: NoArgument,
1106
1505
  # RequiredArgument, etc.
1506
+ #
1107
1507
  class OptionParser::Switch
1508
+ # <!--
1509
+ # rdoc-file=lib/optparse.rb
1510
+ # - guess(arg)
1511
+ # -->
1108
1512
  # Guesses argument style from `arg`. Returns corresponding OptionParser::Switch
1109
1513
  # class (OptionalArgument, etc.).
1110
1514
  #
1111
1515
  def self.guess: (untyped arg) -> untyped
1112
1516
 
1517
+ # <!--
1518
+ # rdoc-file=lib/optparse.rb
1519
+ # - incompatible_argument_styles(arg, t)
1520
+ # -->
1521
+ #
1113
1522
  def self.incompatible_argument_styles: (untyped arg, untyped t) -> untyped
1114
1523
 
1524
+ # <!--
1525
+ # rdoc-file=lib/optparse.rb
1526
+ # - pattern()
1527
+ # -->
1528
+ #
1115
1529
  def self.pattern: () -> untyped
1116
1530
 
1117
1531
  public
@@ -1136,6 +1550,10 @@ class OptionParser::Switch
1136
1550
 
1137
1551
  def short: () -> untyped
1138
1552
 
1553
+ # <!--
1554
+ # rdoc-file=lib/optparse.rb
1555
+ # - summarize(sdone = {}, ldone = {}, width = 1, max = width - 1, indent = "") { |indent| ... }
1556
+ # -->
1139
1557
  # Produces the summary text. Each line of the summary is yielded to the block
1140
1558
  # (without newline).
1141
1559
  #
@@ -1151,63 +1569,113 @@ class OptionParser::Switch
1151
1569
  # `indent`
1152
1570
  # : Prefix string indents all summarized lines.
1153
1571
  #
1154
- #
1155
1572
  def summarize: (?untyped sdone, ?untyped ldone, ?untyped width, ?untyped max, ?untyped indent) -> untyped
1156
1573
 
1574
+ # <!--
1575
+ # rdoc-file=lib/optparse.rb
1576
+ # - switch_name()
1577
+ # -->
1157
1578
  # Main name of the switch.
1158
1579
  #
1159
1580
  def switch_name: () -> untyped
1160
1581
 
1161
1582
  private
1162
1583
 
1584
+ # <!--
1585
+ # rdoc-file=lib/optparse.rb
1586
+ # - conv_arg(arg, val = [])
1587
+ # -->
1163
1588
  # Parses argument, converts and returns `arg`, `block` and result of conversion.
1164
1589
  # Yields at semi-error condition instead of raising an exception.
1165
1590
  #
1166
1591
  def conv_arg: (untyped arg, ?untyped val) -> untyped
1167
1592
 
1593
+ # <!--
1594
+ # rdoc-file=lib/optparse.rb
1595
+ # - new(pattern = nil, conv = nil, short = nil, long = nil, arg = nil, desc = ([] if short or long), block = nil, &_block)
1596
+ # -->
1597
+ #
1168
1598
  def initialize: (?untyped pattern, ?untyped conv, ?untyped short, ?untyped long, ?untyped arg, ?untyped desc, ?untyped block) { (*untyped) -> untyped } -> void
1169
1599
 
1600
+ # <!--
1601
+ # rdoc-file=lib/optparse.rb
1602
+ # - parse_arg(arg) { |InvalidArgument, arg| ... }
1603
+ # -->
1170
1604
  # Parses `arg` and returns rest of `arg` and matched portion to the argument
1171
1605
  # pattern. Yields when the pattern doesn't match substring.
1172
1606
  #
1173
1607
  def parse_arg: (untyped arg) -> untyped
1174
1608
  end
1175
1609
 
1610
+ # <!-- rdoc-file=lib/optparse.rb -->
1176
1611
  # Switch that takes no arguments.
1612
+ #
1177
1613
  class OptionParser::Switch::NoArgument < OptionParser::Switch
1614
+ # <!--
1615
+ # rdoc-file=lib/optparse.rb
1616
+ # - incompatible_argument_styles(*)
1617
+ # -->
1618
+ #
1178
1619
  def self.incompatible_argument_styles: (*untyped) -> untyped
1179
1620
 
1621
+ # <!--
1622
+ # rdoc-file=lib/optparse.rb
1623
+ # - pattern()
1624
+ # -->
1625
+ #
1180
1626
  def self.pattern: () -> untyped
1181
1627
 
1182
1628
  public
1183
1629
 
1630
+ # <!--
1631
+ # rdoc-file=lib/optparse.rb
1632
+ # - parse(arg, argv) { |NeedlessArgument, arg| ... }
1633
+ # -->
1184
1634
  # Raises an exception if any arguments given.
1185
1635
  #
1186
1636
  def parse: (untyped arg, untyped argv) -> untyped
1187
1637
  end
1188
1638
 
1639
+ # <!-- rdoc-file=lib/optparse.rb -->
1189
1640
  # Switch that can omit argument.
1641
+ #
1190
1642
  class OptionParser::Switch::OptionalArgument < OptionParser::Switch
1191
1643
  public
1192
1644
 
1645
+ # <!--
1646
+ # rdoc-file=lib/optparse.rb
1647
+ # - parse(arg, argv, &error)
1648
+ # -->
1193
1649
  # Parses argument if given, or uses default value.
1194
1650
  #
1195
1651
  def parse: (untyped arg, untyped argv) { (*untyped) -> untyped } -> untyped
1196
1652
  end
1197
1653
 
1654
+ # <!-- rdoc-file=lib/optparse.rb -->
1198
1655
  # Switch that takes an argument, which does not begin with '-'.
1656
+ #
1199
1657
  class OptionParser::Switch::PlacedArgument < OptionParser::Switch
1200
1658
  public
1201
1659
 
1660
+ # <!--
1661
+ # rdoc-file=lib/optparse.rb
1662
+ # - parse(arg, argv, &error)
1663
+ # -->
1202
1664
  # Returns nil if argument is not present or begins with '-'.
1203
1665
  #
1204
1666
  def parse: (untyped arg, untyped argv) { (*untyped) -> untyped } -> untyped
1205
1667
  end
1206
1668
 
1669
+ # <!-- rdoc-file=lib/optparse.rb -->
1207
1670
  # Switch that takes an argument.
1671
+ #
1208
1672
  class OptionParser::Switch::RequiredArgument < OptionParser::Switch
1209
1673
  public
1210
1674
 
1675
+ # <!--
1676
+ # rdoc-file=lib/optparse.rb
1677
+ # - parse(arg, argv)
1678
+ # -->
1211
1679
  # Raises an exception if argument is not present.
1212
1680
  #
1213
1681
  def parse: (untyped arg, untyped argv) -> untyped