rbs 3.6.1 → 3.9.5

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 (268) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/dependabot.yml +1 -1
  4. data/.github/workflows/ruby.yml +34 -10
  5. data/.github/workflows/windows.yml +20 -3
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +26 -1
  8. data/CHANGELOG.md +241 -0
  9. data/Rakefile +54 -4
  10. data/config.yml +317 -0
  11. data/core/array.rbs +1756 -1591
  12. data/core/basic_object.rbs +38 -35
  13. data/core/comparable.rbs +1 -1
  14. data/core/complex.rbs +166 -94
  15. data/core/data.rbs +2 -2
  16. data/core/dir.rbs +2 -18
  17. data/core/encoding.rbs +12 -32
  18. data/core/enumerable.rbs +270 -266
  19. data/core/enumerator.rbs +14 -4
  20. data/core/env.rbs +1 -1
  21. data/core/errno.rbs +33 -16
  22. data/core/errors.rbs +6 -2
  23. data/core/exception.rbs +342 -167
  24. data/core/fiber.rbs +3 -2
  25. data/core/file.rbs +26 -75
  26. data/core/float.rbs +125 -72
  27. data/core/gc.rbs +158 -42
  28. data/core/hash.rbs +122 -143
  29. data/core/integer.rbs +79 -50
  30. data/core/io/buffer.rbs +49 -43
  31. data/core/io.rbs +108 -151
  32. data/core/kernel.rbs +341 -209
  33. data/core/match_data.rbs +76 -2
  34. data/core/math.rbs +0 -36
  35. data/core/method.rbs +2 -2
  36. data/core/module.rbs +32 -27
  37. data/core/nil_class.rbs +2 -2
  38. data/core/numeric.rbs +101 -104
  39. data/core/object.rbs +1 -5
  40. data/core/object_space/weak_key_map.rbs +3 -4
  41. data/core/object_space.rbs +3 -3
  42. data/core/proc.rbs +82 -14
  43. data/core/process.rbs +110 -58
  44. data/core/ractor.rbs +57 -4
  45. data/core/range.rbs +114 -87
  46. data/core/rational.rbs +0 -2
  47. data/core/rbs/unnamed/argf.rbs +237 -36
  48. data/core/rbs/unnamed/env_class.rbs +35 -53
  49. data/core/rbs/unnamed/random.rbs +1 -2
  50. data/core/regexp.rbs +10 -56
  51. data/core/ruby_vm.rbs +88 -9
  52. data/core/rubygems/config_file.rbs +3 -0
  53. data/core/rubygems/errors.rbs +3 -6
  54. data/core/rubygems/platform.rbs +0 -9
  55. data/core/rubygems/rubygems.rbs +3 -6
  56. data/core/rubygems/version.rbs +8 -8
  57. data/core/set.rbs +4 -16
  58. data/core/string.rbs +271 -264
  59. data/core/struct.rbs +6 -18
  60. data/core/symbol.rbs +14 -21
  61. data/core/thread.rbs +32 -35
  62. data/core/time.rbs +131 -50
  63. data/core/trace_point.rbs +124 -113
  64. data/core/true_class.rbs +0 -1
  65. data/core/unbound_method.rbs +1 -1
  66. data/core/warning.rbs +9 -2
  67. data/docs/architecture.md +1 -1
  68. data/docs/syntax.md +17 -10
  69. data/ext/rbs_extension/extconf.rb +11 -0
  70. data/ext/rbs_extension/location.c +61 -29
  71. data/ext/rbs_extension/location.h +4 -3
  72. data/ext/rbs_extension/main.c +23 -1
  73. data/ext/rbs_extension/parser.c +506 -517
  74. data/ext/rbs_extension/parserstate.c +109 -30
  75. data/ext/rbs_extension/parserstate.h +6 -4
  76. data/ext/rbs_extension/rbs_extension.h +1 -10
  77. data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
  78. data/include/rbs/ruby_objs.h +72 -0
  79. data/include/rbs/util/rbs_constant_pool.h +219 -0
  80. data/include/rbs.h +7 -0
  81. data/lib/rbs/annotate/annotations.rb +3 -3
  82. data/lib/rbs/annotate/rdoc_source.rb +2 -2
  83. data/lib/rbs/ast/declarations.rb +9 -4
  84. data/lib/rbs/ast/directives.rb +10 -0
  85. data/lib/rbs/ast/members.rb +2 -0
  86. data/lib/rbs/ast/type_param.rb +2 -12
  87. data/lib/rbs/cli/diff.rb +3 -3
  88. data/lib/rbs/cli/validate.rb +2 -1
  89. data/lib/rbs/cli.rb +16 -16
  90. data/lib/rbs/collection/config/lockfile_generator.rb +58 -8
  91. data/lib/rbs/collection/config.rb +5 -3
  92. data/lib/rbs/collection/sources/rubygems.rb +1 -1
  93. data/lib/rbs/collection.rb +1 -0
  94. data/lib/rbs/definition.rb +51 -34
  95. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -3
  96. data/lib/rbs/definition_builder.rb +83 -24
  97. data/lib/rbs/environment.rb +33 -18
  98. data/lib/rbs/environment_loader.rb +6 -1
  99. data/lib/rbs/errors.rb +24 -0
  100. data/lib/rbs/locator.rb +2 -0
  101. data/lib/rbs/method_type.rb +2 -0
  102. data/lib/rbs/namespace.rb +1 -0
  103. data/lib/rbs/parser_aux.rb +40 -3
  104. data/lib/rbs/prototype/rb.rb +20 -12
  105. data/lib/rbs/prototype/rbi.rb +11 -6
  106. data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
  107. data/lib/rbs/prototype/runtime.rb +7 -5
  108. data/lib/rbs/subtractor.rb +3 -3
  109. data/lib/rbs/test/hook.rb +47 -42
  110. data/lib/rbs/test/type_check.rb +7 -5
  111. data/lib/rbs/type_name.rb +14 -9
  112. data/lib/rbs/types.rb +63 -14
  113. data/lib/rbs/unit_test/spy.rb +4 -2
  114. data/lib/rbs/unit_test/type_assertions.rb +19 -13
  115. data/lib/rbs/unit_test/with_aliases.rb +3 -1
  116. data/lib/rbs/validator.rb +7 -1
  117. data/lib/rbs/version.rb +1 -1
  118. data/lib/rbs/writer.rb +10 -5
  119. data/lib/rbs.rb +1 -0
  120. data/lib/rdoc_plugin/parser.rb +2 -2
  121. data/rbs.gemspec +6 -2
  122. data/sig/ancestor_graph.rbs +5 -5
  123. data/sig/annotate/rdoc_source.rbs +2 -0
  124. data/sig/cli.rbs +2 -0
  125. data/sig/collection/config/lockfile_generator.rbs +9 -1
  126. data/sig/declarations.rbs +10 -3
  127. data/sig/definition.rbs +80 -12
  128. data/sig/definition_builder.rbs +18 -4
  129. data/sig/directives.rbs +17 -1
  130. data/sig/environment.rbs +3 -1
  131. data/sig/errors.rbs +19 -0
  132. data/sig/namespace.rbs +2 -3
  133. data/sig/parser.rbs +5 -1
  134. data/sig/prototype/rb.rbs +1 -1
  135. data/sig/resolver/constant_resolver.rbs +2 -2
  136. data/sig/resolver/context.rbs +1 -1
  137. data/sig/subtractor.rbs +1 -1
  138. data/sig/test/type_check.rbs +2 -2
  139. data/sig/type_alias_dependency.rbs +2 -2
  140. data/sig/type_alias_regularity.rbs +6 -6
  141. data/sig/type_param.rbs +4 -4
  142. data/sig/typename.rbs +8 -5
  143. data/sig/types.rbs +1 -1
  144. data/sig/unit_test/spy.rbs +2 -0
  145. data/sig/unit_test/type_assertions.rbs +2 -0
  146. data/sig/use_map.rbs +1 -1
  147. data/sig/validator.rbs +6 -2
  148. data/sig/vendorer.rbs +1 -1
  149. data/sig/writer.rbs +1 -1
  150. data/{ext/rbs_extension → src}/constants.c +35 -36
  151. data/src/ruby_objs.c +799 -0
  152. data/src/util/rbs_constant_pool.c +342 -0
  153. data/stdlib/base64/0/base64.rbs +0 -9
  154. data/stdlib/benchmark/0/benchmark.rbs +11 -2
  155. data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
  156. data/stdlib/cgi/0/core.rbs +60 -3
  157. data/stdlib/cgi/0/manifest.yaml +1 -0
  158. data/stdlib/coverage/0/coverage.rbs +0 -3
  159. data/stdlib/csv/0/csv.rbs +18 -58
  160. data/stdlib/csv/0/manifest.yaml +1 -0
  161. data/stdlib/date/0/date.rbs +27 -42
  162. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -6
  163. data/stdlib/digest/0/digest.rbs +25 -2
  164. data/stdlib/erb/0/erb.rbs +0 -1
  165. data/stdlib/etc/0/etc.rbs +51 -34
  166. data/stdlib/fileutils/0/fileutils.rbs +3 -44
  167. data/stdlib/io-console/0/io-console.rbs +69 -15
  168. data/stdlib/ipaddr/0/ipaddr.rbs +16 -4
  169. data/stdlib/json/0/json.rbs +107 -120
  170. data/stdlib/logger/0/log_device.rbs +1 -1
  171. data/stdlib/logger/0/logger.rbs +3 -18
  172. data/stdlib/minitest/0/kernel.rbs +2 -2
  173. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
  174. data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
  175. data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
  176. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
  177. data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
  178. data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
  179. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  180. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  181. data/stdlib/minitest/0/minitest/mock.rbs +9 -5
  182. data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
  183. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
  184. data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
  185. data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
  186. data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
  187. data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
  188. data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
  189. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
  190. data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
  191. data/stdlib/minitest/0/minitest/spec.rbs +1 -1
  192. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
  193. data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
  194. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
  195. data/stdlib/minitest/0/minitest/test.rbs +7 -14
  196. data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
  197. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  198. data/stdlib/minitest/0/minitest/unit.rbs +1 -2
  199. data/stdlib/minitest/0/minitest.rbs +41 -892
  200. data/stdlib/monitor/0/monitor.rbs +13 -4
  201. data/stdlib/net-http/0/net-http.rbs +42 -109
  202. data/stdlib/nkf/0/nkf.rbs +30 -0
  203. data/stdlib/objspace/0/objspace.rbs +1 -2
  204. data/stdlib/observable/0/observable.rbs +1 -1
  205. data/stdlib/open-uri/0/manifest.yaml +1 -0
  206. data/stdlib/open-uri/0/open-uri.rbs +52 -0
  207. data/stdlib/open3/0/open3.rbs +0 -8
  208. data/stdlib/openssl/0/manifest.yaml +1 -0
  209. data/stdlib/openssl/0/openssl.rbs +235 -143
  210. data/stdlib/optparse/0/optparse.rbs +58 -18
  211. data/stdlib/pathname/0/pathname.rbs +2 -8
  212. data/stdlib/pp/0/pp.rbs +3 -1
  213. data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
  214. data/stdlib/pstore/0/pstore.rbs +0 -6
  215. data/stdlib/psych/0/core_ext.rbs +12 -0
  216. data/stdlib/psych/0/psych.rbs +15 -4
  217. data/stdlib/pty/0/pty.rbs +46 -4
  218. data/stdlib/rdoc/0/code_object.rbs +0 -4
  219. data/stdlib/rdoc/0/markup.rbs +10 -12
  220. data/stdlib/rdoc/0/rdoc.rbs +13 -8
  221. data/stdlib/resolv/0/resolv.rbs +21 -12
  222. data/stdlib/ripper/0/ripper.rbs +0 -2
  223. data/stdlib/securerandom/0/securerandom.rbs +7 -2
  224. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  225. data/stdlib/singleton/0/singleton.rbs +0 -1
  226. data/stdlib/socket/0/addrinfo.rbs +1 -2
  227. data/stdlib/socket/0/basic_socket.rbs +0 -5
  228. data/stdlib/socket/0/socket.rbs +32 -27
  229. data/stdlib/socket/0/tcp_server.rbs +0 -3
  230. data/stdlib/socket/0/tcp_socket.rbs +36 -3
  231. data/stdlib/socket/0/udp_socket.rbs +0 -1
  232. data/stdlib/socket/0/unix_server.rbs +0 -3
  233. data/stdlib/socket/0/unix_socket.rbs +4 -2
  234. data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +1 -1
  235. data/stdlib/strscan/0/string_scanner.rbs +1265 -422
  236. data/stdlib/tempfile/0/tempfile.rbs +135 -28
  237. data/stdlib/time/0/time.rbs +48 -35
  238. data/stdlib/timeout/0/timeout.rbs +11 -8
  239. data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
  240. data/stdlib/tsort/0/tsort.rbs +0 -4
  241. data/stdlib/uri/0/common.rbs +28 -30
  242. data/stdlib/uri/0/ftp.rbs +1 -1
  243. data/stdlib/uri/0/generic.rbs +22 -18
  244. data/stdlib/uri/0/http.rbs +2 -2
  245. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  246. data/stdlib/zlib/0/buf_error.rbs +1 -70
  247. data/stdlib/zlib/0/data_error.rbs +1 -70
  248. data/stdlib/zlib/0/deflate.rbs +8 -72
  249. data/stdlib/zlib/0/error.rbs +1 -70
  250. data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
  251. data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
  252. data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
  253. data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
  254. data/stdlib/zlib/0/gzip_file.rbs +1 -71
  255. data/stdlib/zlib/0/gzip_reader.rbs +3 -74
  256. data/stdlib/zlib/0/gzip_writer.rbs +1 -70
  257. data/stdlib/zlib/0/inflate.rbs +4 -71
  258. data/stdlib/zlib/0/mem_error.rbs +1 -70
  259. data/stdlib/zlib/0/need_dict.rbs +1 -70
  260. data/stdlib/zlib/0/stream_end.rbs +1 -70
  261. data/stdlib/zlib/0/stream_error.rbs +1 -70
  262. data/stdlib/zlib/0/version_error.rbs +1 -70
  263. data/stdlib/zlib/0/zlib.rbs +0 -2
  264. data/stdlib/zlib/0/zstream.rbs +4 -72
  265. metadata +17 -13
  266. data/ext/rbs_extension/ruby_objs.c +0 -602
  267. data/ext/rbs_extension/ruby_objs.h +0 -51
  268. data/stdlib/minitest/0/manifest.yaml +0 -2
@@ -21,7 +21,6 @@
21
21
  # 4. Arguments can be automatically converted to a specified class.
22
22
  # 5. Arguments can be restricted to a certain set.
23
23
  #
24
- #
25
24
  # All of these features are demonstrated in the examples below. See
26
25
  # #make_switch for full documentation.
27
26
  #
@@ -129,7 +128,6 @@
129
128
  # * Array -- Strings separated by ',' (e.g. 1,2,3)
130
129
  # * Regexp -- Regular expressions. Also includes options.
131
130
  #
132
- #
133
131
  # We can also add our own coercions, which we will cover below.
134
132
  #
135
133
  # #### Using Built-in Conversions
@@ -431,6 +429,7 @@ class OptionParser
431
429
  # rdoc-file=lib/optparse.rb
432
430
  # - terminate(arg = nil)
433
431
  # -->
432
+ # See #terminate.
434
433
  #
435
434
  def self.terminate: (?String arg) -> bot
436
435
 
@@ -438,6 +437,9 @@ class OptionParser
438
437
  # rdoc-file=lib/optparse.rb
439
438
  # - top()
440
439
  # -->
440
+ # Returns the global top option list.
441
+ #
442
+ # Do not use directly.
441
443
  #
442
444
  def self.top: () -> OptionParser::List
443
445
 
@@ -458,6 +460,13 @@ class OptionParser
458
460
  # rdoc-file=lib/optparse.rb
459
461
  # - abort(mesg = $!)
460
462
  # -->
463
+ # Shows message with the program name then aborts.
464
+ #
465
+ # `mesg`
466
+ # : Message, defaulted to +$!+.
467
+ #
468
+ #
469
+ # See Kernel#abort.
461
470
  #
462
471
  def abort: (?_ToS mesg) -> bot
463
472
 
@@ -470,6 +479,7 @@ class OptionParser
470
479
  #
471
480
  # `t`
472
481
  # : Argument class specifier, any object including Class.
482
+ #
473
483
  # `pat`
474
484
  # : Pattern for argument, defaults to `t` if it responds to match.
475
485
  #
@@ -505,6 +515,7 @@ class OptionParser
505
515
  # rdoc-file=lib/optparse.rb
506
516
  # - candidate(word)
507
517
  # -->
518
+ # Return candidates for `word`.
508
519
  #
509
520
  def candidate: (String word) -> Array[untyped]
510
521
 
@@ -589,7 +600,7 @@ class OptionParser
589
600
 
590
601
  # <!--
591
602
  # rdoc-file=lib/optparse.rb
592
- # - environment(env = File.basename($0, '.*'))
603
+ # - environment(env = File.basename($0, '.*'), **keywords)
593
604
  # -->
594
605
  # Parses environment variable `env` or its uppercase with splitting like a
595
606
  # shell.
@@ -600,7 +611,7 @@ class OptionParser
600
611
 
601
612
  # <!--
602
613
  # rdoc-file=lib/optparse.rb
603
- # - getopts(*args, symbolize_names: false)
614
+ # - getopts(*args, symbolize_names: false, **keywords)
604
615
  # -->
605
616
  # Wrapper method for getopts.rb.
606
617
  #
@@ -636,12 +647,13 @@ class OptionParser
636
647
  # rdoc-file=lib/optparse.rb
637
648
  # - inc(*args)
638
649
  # -->
650
+ # See self.inc
639
651
  #
640
652
  def inc: (*untyped args) -> untyped
641
653
 
642
654
  # <!--
643
655
  # rdoc-file=lib/optparse.rb
644
- # - load(filename = nil, into: nil)
656
+ # - load(filename = nil, **keywords)
645
657
  # -->
646
658
  # Loads options from file names as `filename`. Does nothing when the file is not
647
659
  # present. Returns whether successfully loaded.
@@ -675,6 +687,9 @@ class OptionParser
675
687
  # -->
676
688
  # Pushes a new List.
677
689
  #
690
+ # If a block is given, yields `self` and returns the result of the block,
691
+ # otherwise returns `self`.
692
+ #
678
693
  def new: () -> self
679
694
  | [T] () { (self) -> T } -> T
680
695
 
@@ -741,7 +756,7 @@ class OptionParser
741
756
 
742
757
  # <!--
743
758
  # rdoc-file=lib/optparse.rb
744
- # - order(*argv, into: nil, &nonopt)
759
+ # - order(*argv, **keywords, &nonopt)
745
760
  # -->
746
761
  # Parses command line arguments `argv` in order. When a block is given, each
747
762
  # non-option argument is yielded. When optional `into` keyword argument is
@@ -755,7 +770,7 @@ class OptionParser
755
770
 
756
771
  # <!--
757
772
  # rdoc-file=lib/optparse.rb
758
- # - order!(argv = default_argv, into: nil, &nonopt)
773
+ # - order!(argv = default_argv, into: nil, **keywords, &nonopt)
759
774
  # -->
760
775
  # Same as #order, but removes switches destructively. Non-option arguments
761
776
  # remain in `argv`.
@@ -764,7 +779,7 @@ class OptionParser
764
779
 
765
780
  # <!--
766
781
  # rdoc-file=lib/optparse.rb
767
- # - parse(*argv, into: nil)
782
+ # - parse(*argv, **keywords)
768
783
  # -->
769
784
  # Parses command line arguments `argv` in order when environment variable
770
785
  # POSIXLY_CORRECT is set, and in permutation mode otherwise. When optional
@@ -776,7 +791,7 @@ class OptionParser
776
791
 
777
792
  # <!--
778
793
  # rdoc-file=lib/optparse.rb
779
- # - parse!(argv = default_argv, into: nil)
794
+ # - parse!(argv = default_argv, **keywords)
780
795
  # -->
781
796
  # Same as #parse, but removes switches destructively. Non-option arguments
782
797
  # remain in `argv`.
@@ -785,7 +800,7 @@ class OptionParser
785
800
 
786
801
  # <!--
787
802
  # rdoc-file=lib/optparse.rb
788
- # - permute(*argv, into: nil)
803
+ # - permute(*argv, **keywords)
789
804
  # -->
790
805
  # Parses command line arguments `argv` in permutation mode and returns list of
791
806
  # non-option arguments. When optional `into` keyword argument is provided, the
@@ -797,7 +812,7 @@ class OptionParser
797
812
 
798
813
  # <!--
799
814
  # rdoc-file=lib/optparse.rb
800
- # - permute!(argv = default_argv, into: nil)
815
+ # - permute!(argv = default_argv, **keywords)
801
816
  # -->
802
817
  # Same as #permute, but removes switches destructively. Non-option arguments
803
818
  # remain in `argv`.
@@ -816,11 +831,11 @@ class OptionParser
816
831
  # -->
817
832
  # Directs to reject specified class argument.
818
833
  #
819
- # `t`
834
+ # `type`
820
835
  # : Argument class specifier, any object including Class.
821
836
  #
822
837
  #
823
- # reject(t)
838
+ # reject(type)
824
839
  #
825
840
  def reject: (Class t) -> void
826
841
 
@@ -884,10 +899,13 @@ class OptionParser
884
899
  #
885
900
  # `to`
886
901
  # : Output destination, which must have method <<. Defaults to [].
902
+ #
887
903
  # `width`
888
904
  # : Width of left side, defaults to @summary_width.
905
+ #
889
906
  # `max`
890
907
  # : Maximum length allowed for left side, defaults to `width` - 1.
908
+ #
891
909
  # `indent`
892
910
  # : Indentation, defaults to @summary_indent.
893
911
  #
@@ -952,6 +970,13 @@ class OptionParser
952
970
  # rdoc-file=lib/optparse.rb
953
971
  # - warn(mesg = $!)
954
972
  # -->
973
+ # Shows warning message with the program name
974
+ #
975
+ # `mesg`
976
+ # : Message, defaulted to +$!+.
977
+ #
978
+ #
979
+ # See Kernel#warn.
955
980
  #
956
981
  def warn: (?_ToS mesg) -> void
957
982
 
@@ -983,8 +1008,10 @@ class OptionParser
983
1008
  #
984
1009
  # `banner`
985
1010
  # : Banner message.
1011
+ #
986
1012
  # `width`
987
1013
  # : Summary width.
1014
+ #
988
1015
  # `indent`
989
1016
  # : Summary indent.
990
1017
  #
@@ -1064,6 +1091,9 @@ OptionParser::RequiredArgument: Array[untyped]
1064
1091
 
1065
1092
  OptionParser::SPLAT_PROC: Proc
1066
1093
 
1094
+ # <!-- rdoc-file=lib/optparse.rb -->
1095
+ # The version string
1096
+ #
1067
1097
  OptionParser::Version: String
1068
1098
 
1069
1099
  # <!-- rdoc-file=lib/optparse.rb -->
@@ -1109,7 +1139,7 @@ module OptionParser::Arguable
1109
1139
 
1110
1140
  # <!--
1111
1141
  # rdoc-file=lib/optparse.rb
1112
- # - getopts(*args, symbolize_names: false)
1142
+ # - getopts(*args, symbolize_names: false, **keywords)
1113
1143
  # -->
1114
1144
  # Substitution of getopts is possible as follows. Also see OptionParser#getopts.
1115
1145
  #
@@ -1148,7 +1178,7 @@ module OptionParser::Arguable
1148
1178
 
1149
1179
  # <!--
1150
1180
  # rdoc-file=lib/optparse.rb
1151
- # - order!(&blk)
1181
+ # - order!(**keywords, &blk)
1152
1182
  # -->
1153
1183
  # Parses `self` destructively in order and returns `self` containing the rest
1154
1184
  # arguments left unparsed.
@@ -1157,7 +1187,7 @@ module OptionParser::Arguable
1157
1187
 
1158
1188
  # <!--
1159
1189
  # rdoc-file=lib/optparse.rb
1160
- # - parse!()
1190
+ # - parse!(**keywords)
1161
1191
  # -->
1162
1192
  # Parses `self` destructively and returns `self` containing the rest arguments
1163
1193
  # left unparsed.
@@ -1166,7 +1196,7 @@ module OptionParser::Arguable
1166
1196
 
1167
1197
  # <!--
1168
1198
  # rdoc-file=lib/optparse.rb
1169
- # - permute!()
1199
+ # - permute!(**keywords)
1170
1200
  # -->
1171
1201
  # Parses `self` destructively in permutation mode and returns `self` containing
1172
1202
  # the rest arguments left unparsed.
@@ -1271,10 +1301,13 @@ class OptionParser::List
1271
1301
  #
1272
1302
  # `switch`
1273
1303
  # : OptionParser::Switch instance to be inserted.
1304
+ #
1274
1305
  # `short_opts`
1275
1306
  # : List of short style options.
1307
+ #
1276
1308
  # `long_opts`
1277
1309
  # : List of long style options.
1310
+ #
1278
1311
  # `nolong_opts`
1279
1312
  # : List of long style options with "no-" prefix.
1280
1313
  #
@@ -1334,10 +1367,13 @@ class OptionParser::List
1334
1367
  #
1335
1368
  # `switch`
1336
1369
  # : OptionParser::Switch instance to be inserted.
1370
+ #
1337
1371
  # `short_opts`
1338
1372
  # : List of short style options.
1373
+ #
1339
1374
  # `long_opts`
1340
1375
  # : List of long style options.
1376
+ #
1341
1377
  # `nolong_opts`
1342
1378
  # : List of long style options with "no-" prefix.
1343
1379
  #
@@ -1570,13 +1606,17 @@ class OptionParser::Switch
1570
1606
  #
1571
1607
  # `sdone`
1572
1608
  # : Already summarized short style options keyed hash.
1609
+ #
1573
1610
  # `ldone`
1574
1611
  # : Already summarized long style options keyed hash.
1612
+ #
1575
1613
  # `width`
1576
1614
  # : Width of left side (option part). In other words, the right side
1577
1615
  # (description part) starts after `width` columns.
1616
+ #
1578
1617
  # `max`
1579
1618
  # : Maximum width of left side -> the options are filled within `max` columns.
1619
+ #
1580
1620
  # `indent`
1581
1621
  # : Prefix string indents all summarized lines.
1582
1622
  #
@@ -1677,7 +1717,7 @@ end
1677
1717
  class OptionParser::Switch::RequiredArgument < OptionParser::Switch
1678
1718
  # <!--
1679
1719
  # rdoc-file=lib/optparse.rb
1680
- # - parse(arg, argv)
1720
+ # - parse(arg, argv, &_)
1681
1721
  # -->
1682
1722
  # Raises an exception if argument is not present.
1683
1723
  #
@@ -82,7 +82,6 @@
82
82
  # * #each_child
83
83
  # * #mountpoint?
84
84
  #
85
- #
86
85
  # ### File status predicate methods
87
86
  #
88
87
  # These methods are a facade for FileTest:
@@ -111,7 +110,6 @@
111
110
  # * #writable_real?
112
111
  # * #zero?
113
112
  #
114
- #
115
113
  # ### File property and manipulation methods
116
114
  #
117
115
  # These methods are a facade for File:
@@ -142,7 +140,6 @@
142
140
  # * #expand_path(*args)
143
141
  # * #split
144
142
  #
145
- #
146
143
  # ### Directory methods
147
144
  #
148
145
  # These methods are a facade for Dir:
@@ -154,7 +151,6 @@
154
151
  # * #mkdir(*args)
155
152
  # * #opendir(*args)
156
153
  #
157
- #
158
154
  # ### IO
159
155
  #
160
156
  # These methods are a facade for IO:
@@ -166,7 +162,6 @@
166
162
  # * #write(*args)
167
163
  # * #binwrite(*args)
168
164
  #
169
- #
170
165
  # ### Utilities
171
166
  #
172
167
  # These methods are a mixture of Find, FileUtils, and others:
@@ -175,7 +170,6 @@
175
170
  # * #rmtree
176
171
  # * #unlink / #delete
177
172
  #
178
- #
179
173
  # ## Method documentation
180
174
  #
181
175
  # As the above section shows, most of the methods in Pathname are facades. The
@@ -901,7 +895,7 @@ class Pathname
901
895
  #
902
896
  # See FileUtils.mkpath and FileUtils.mkdir_p
903
897
  #
904
- def mkpath: () -> nil
898
+ def mkpath: () -> self
905
899
 
906
900
  # <!--
907
901
  # rdoc-file=ext/pathname/lib/pathname.rb
@@ -1112,7 +1106,7 @@ class Pathname
1112
1106
  #
1113
1107
  # See FileUtils.rm_rf
1114
1108
  #
1115
- def rmtree: () -> void
1109
+ def rmtree: () -> self
1116
1110
 
1117
1111
  # <!--
1118
1112
  # rdoc-file=ext/pathname/lib/pathname.rb
data/stdlib/pp/0/pp.rbs CHANGED
@@ -72,6 +72,9 @@ class PP < PrettyPrint
72
72
  def group: (?Integer indent, ?String open_obj, ?String close_obj, ?Integer open_width, ?Integer close_width) { () -> untyped } -> void
73
73
  end
74
74
 
75
+ # <!-- rdoc-file=lib/pp.rb -->
76
+ # Module that defines helper methods for pretty_print.
77
+ #
75
78
  module PPMethods : _PPMethodsRequired
76
79
  # <!--
77
80
  # rdoc-file=lib/pp.rb
@@ -222,7 +225,6 @@ class PP < PrettyPrint
222
225
  # variable is assumed to be set to the width.
223
226
  # 3. If `COLUMN` is not set to a non-zero number, 80 is assumed.
224
227
  #
225
- #
226
228
  # And finally, returns the above width value - 1.
227
229
  # * This -1 is for Windows command prompt, which moves the cursor to the next
228
230
  # line if it reaches the last column.
@@ -9,18 +9,15 @@
9
9
  # * optional width argument for PrettyPrint#text
10
10
  # * PrettyPrint#breakable
11
11
  #
12
- #
13
12
  # There are several candidate uses:
14
13
  # * text formatting using proportional fonts
15
14
  # * multibyte characters which has columns different to number of bytes
16
15
  # * non-string formatting
17
16
  #
18
- #
19
17
  # ## Bugs
20
18
  # * Box based formatting?
21
19
  # * Other (better) model/algorithm?
22
20
  #
23
- #
24
21
  # Report any bugs at http://bugs.ruby-lang.org
25
22
  #
26
23
  # ## References
@@ -316,7 +313,6 @@ class PrettyPrint
316
313
  # * #flush
317
314
  # * #first?
318
315
  #
319
- #
320
316
  # but instead, the output has no line breaks
321
317
  #
322
318
  class SingleLine
@@ -21,7 +21,6 @@
21
21
  # collection of prospective changes to the store; a transaction is defined
22
22
  # in the block given with a call to PStore#transaction.
23
23
  #
24
- #
25
24
  # ## About the Examples
26
25
  #
27
26
  # Examples on this page need a store that has known properties. They can get a
@@ -73,7 +72,6 @@
73
72
  # must also be Marshal-able. See [Hierarchical
74
73
  # Values](rdoc-ref:PStore@Hierarchical+Values).
75
74
  #
76
- #
77
75
  # ## Transactions
78
76
  #
79
77
  # ### The Transaction Block
@@ -104,7 +102,6 @@
104
102
  # * Is the only context where methods that read from or write to the store are
105
103
  # allowed.
106
104
  #
107
- #
108
105
  # As seen above, changes in a transaction are made automatically when the block
109
106
  # exits. The block may be exited early by calling method #commit or #abort.
110
107
  #
@@ -138,7 +135,6 @@
138
135
  # end
139
136
  # end
140
137
  #
141
- #
142
138
  # ### Read-Only Transactions
143
139
  #
144
140
  # By default, a transaction allows both reading from and writing to the store:
@@ -250,7 +246,6 @@
250
246
  # * Optional argument `thread_safe` at method PStore.new.
251
247
  # * Attribute #ultra_safe.
252
248
  #
253
- #
254
249
  # Needless to say, if you're storing valuable data with PStore, then you should
255
250
  # backup the PStore file from time to time.
256
251
  #
@@ -403,7 +398,6 @@ class PStore
403
398
  # end
404
399
  # end
405
400
  #
406
- #
407
401
  # Raises an exception if called outside a transaction block.
408
402
  #
409
403
  def fetch: (untyped name, ?untyped default) -> untyped
@@ -0,0 +1,12 @@
1
+ %a{annotate:rdoc:skip}
2
+ class Object
3
+ # <!--
4
+ # rdoc-file=ext/psych/lib/psych/core_ext.rb
5
+ # - to_yaml(options = {})
6
+ # -->
7
+ # Convert an object to YAML. See Psych.dump for more information on the
8
+ # available `options`.
9
+ #
10
+ def to_yaml: (?indentation: Integer, ?line_width: Integer, ?canonical: bool, ?header: bool) -> String
11
+ | [IO] (IO, ?indentation: Integer, ?line_width: Integer, ?canonical: bool, ?header: bool) -> IO
12
+ end
@@ -219,20 +219,29 @@ module Psych
219
219
  # `0..9` range, otherwise option is ignored.
220
220
  #
221
221
  # Default: `2`.
222
+ #
222
223
  # `:line_width`
223
- # : Max character to wrap line at.
224
+ # : Max character to wrap line at. For unlimited line width use `-1`.
224
225
  #
225
226
  # Default: `0` (meaning "wrap at 81").
227
+ #
226
228
  # `:canonical`
227
229
  # : Write "canonical" YAML form (very verbose, yet strictly formal).
228
230
  #
229
231
  # Default: `false`.
232
+ #
230
233
  # `:header`
231
234
  # : Write `%YAML [version]` at the beginning of document.
232
235
  #
233
236
  # Default: `false`.
234
237
  #
235
238
  #
239
+ # `:stringify_names`
240
+ # : Dump symbol keys in Hash objects as string.
241
+ #
242
+ # Default: `false`.
243
+ #
244
+ #
236
245
  # Example:
237
246
  #
238
247
  # # Dump an array, get back a YAML string
@@ -247,6 +256,9 @@ module Psych
247
256
  # # Dump an array to an IO with indentation set
248
257
  # Psych.dump(['a', ['b']], StringIO.new, indentation: 3)
249
258
  #
259
+ # # Dump hash with symbol keys as string
260
+ # Psych.dump({a: "b"}, stringify_names: true) # => "---\na: b\n"
261
+ #
250
262
  %a{annotate:rdoc:copy:Psych.dump}
251
263
  def self.dump: (untyped o, ?indentation: Integer, ?line_width: Integer, ?canonical: bool, ?header: bool) -> String
252
264
  | [IO] (untyped o, IO, ?indentation: Integer, ?line_width: Integer, ?canonical: bool, ?header: bool) -> IO
@@ -259,7 +271,7 @@ module Psych
259
271
  # the object contained in the first document will be returned. `filename` will
260
272
  # be used in the exception message if any exception is raised while parsing. If
261
273
  # `yaml` is empty, it returns the specified `fallback` return value, which
262
- # defaults to `false`.
274
+ # defaults to `nil`.
263
275
  #
264
276
  # Raises a Psych::SyntaxError when a YAML syntax error is detected.
265
277
  #
@@ -293,7 +305,7 @@ module Psych
293
305
  # -->
294
306
  # Loads the document contained in `filename`. Returns the yaml contained in
295
307
  # `filename` as a Ruby object, or if the file is empty, it returns the specified
296
- # `fallback` return value, which defaults to `false`. See load for options.
308
+ # `fallback` return value, which defaults to `nil`. See load for options.
297
309
  #
298
310
  %a{annotate:rdoc:copy:Psych.load_file}
299
311
  def self.load_file: (string | _ToPath, ?fallback: untyped, ?symbolize_names: bool, ?freeze: bool) -> untyped
@@ -314,7 +326,6 @@ module Psych
314
326
  # * Array
315
327
  # * Hash
316
328
  #
317
- #
318
329
  # Recursive data structures are not allowed by default. Arbitrary classes can
319
330
  # be allowed by adding those classes to the `permitted_classes` keyword
320
331
  # argument. They are additive. For example, to allow Date deserialization:
data/stdlib/pty/0/pty.rbs CHANGED
@@ -68,6 +68,7 @@ module PTY
68
68
  #
69
69
  # `pid`
70
70
  # : The process id of the process to check
71
+ #
71
72
  # `raise`
72
73
  # : If `true` and the process identified by `pid` is no longer alive a
73
74
  # PTY::ChildExited is raised.
@@ -85,9 +86,17 @@ module PTY
85
86
  # the spawned pty.
86
87
  #
87
88
  # # sets FOO to "bar"
88
- # PTY.spawn({"FOO"=>"bar"}, "printenv", "FOO") { |r,w,pid| p r.read } #=> "bar\r\n"
89
+ # PTY.spawn({"FOO"=>"bar"}, "printenv", "FOO") do |r, w, pid|
90
+ # p r.read #=> "bar\r\n"
91
+ # ensure
92
+ # r.close; w.close; Process.wait(pid)
93
+ # end
89
94
  # # unsets FOO
90
- # PTY.spawn({"FOO"=>nil}, "printenv", "FOO") { |r,w,pid| p r.read } #=> ""
95
+ # PTY.spawn({"FOO"=>nil}, "printenv", "FOO") do |r, w, pid|
96
+ # p r.read #=> ""
97
+ # ensure
98
+ # r.close; w.close; Process.wait(pid)
99
+ # end
91
100
  #
92
101
  # `command` and `command_line` are the full commands to run, given a String. Any
93
102
  # additional `arguments` will be passed to the command.
@@ -101,11 +110,23 @@ module PTY
101
110
  # `r`
102
111
  # : A readable IO that contains the command's standard output and standard
103
112
  # error
113
+ #
104
114
  # `w`
105
115
  # : A writable IO that is the command's standard input
116
+ #
106
117
  # `pid`
107
118
  # : The process identifier for the command.
108
119
  #
120
+ #
121
+ # ### Clean up
122
+ #
123
+ # This method does not clean up like closing IOs or waiting for child process,
124
+ # except that the process is detached in the block form to prevent it from
125
+ # becoming a zombie (see Process.detach). Any other cleanup is the
126
+ # responsibility of the caller. If waiting for `pid`, be sure to close both `r`
127
+ # and `w` before doing so; doing it in the reverse order may cause deadlock on
128
+ # some OSes.
129
+ #
109
130
  alias self.getpty self.spawn
110
131
 
111
132
  # <!--
@@ -136,6 +157,7 @@ module PTY
136
157
  #
137
158
  # `master_io`
138
159
  # : the master of the pty, as an IO.
160
+ #
139
161
  # `slave_file`
140
162
  # : the slave of the pty, as a File. The path to the terminal device is
141
163
  # available via `slave_file.path`
@@ -169,9 +191,17 @@ module PTY
169
191
  # the spawned pty.
170
192
  #
171
193
  # # sets FOO to "bar"
172
- # PTY.spawn({"FOO"=>"bar"}, "printenv", "FOO") { |r,w,pid| p r.read } #=> "bar\r\n"
194
+ # PTY.spawn({"FOO"=>"bar"}, "printenv", "FOO") do |r, w, pid|
195
+ # p r.read #=> "bar\r\n"
196
+ # ensure
197
+ # r.close; w.close; Process.wait(pid)
198
+ # end
173
199
  # # unsets FOO
174
- # PTY.spawn({"FOO"=>nil}, "printenv", "FOO") { |r,w,pid| p r.read } #=> ""
200
+ # PTY.spawn({"FOO"=>nil}, "printenv", "FOO") do |r, w, pid|
201
+ # p r.read #=> ""
202
+ # ensure
203
+ # r.close; w.close; Process.wait(pid)
204
+ # end
175
205
  #
176
206
  # `command` and `command_line` are the full commands to run, given a String. Any
177
207
  # additional `arguments` will be passed to the command.
@@ -185,11 +215,23 @@ module PTY
185
215
  # `r`
186
216
  # : A readable IO that contains the command's standard output and standard
187
217
  # error
218
+ #
188
219
  # `w`
189
220
  # : A writable IO that is the command's standard input
221
+ #
190
222
  # `pid`
191
223
  # : The process identifier for the command.
192
224
  #
225
+ #
226
+ # ### Clean up
227
+ #
228
+ # This method does not clean up like closing IOs or waiting for child process,
229
+ # except that the process is detached in the block form to prevent it from
230
+ # becoming a zombie (see Process.detach). Any other cleanup is the
231
+ # responsibility of the caller. If waiting for `pid`, be sure to close both `r`
232
+ # and `w` before doing so; doing it in the reverse order may cause deadlock on
233
+ # some OSes.
234
+ #
193
235
  def self.spawn: (*String command) -> [ IO, IO, Integer ]
194
236
  | (*String command) { ([ IO, IO, Integer ]) -> void } -> void
195
237
  end
@@ -15,15 +15,11 @@ module RDoc
15
15
  # * RDoc::NormalClass
16
16
  # * RDoc::NormalModule
17
17
  # * RDoc::SingleClass
18
- #
19
- #
20
18
  # * RDoc::MethodAttr
21
19
  # * RDoc::Attr
22
20
  # * RDoc::AnyMethod
23
21
  # * RDoc::GhostMethod
24
22
  # * RDoc::MetaMethod
25
- #
26
- #
27
23
  # * RDoc::Alias
28
24
  # * RDoc::Constant
29
25
  # * RDoc::Mixin
@@ -11,20 +11,16 @@ module RDoc
11
11
  # RDoc::Markup and other markup formats do no output formatting, this is handled
12
12
  # by the RDoc::Markup::Formatter subclasses.
13
13
  #
14
- # # Supported Formats
14
+ # # Markup Formats
15
15
  #
16
- # Besides the RDoc::Markup format, the following formats are built in to RDoc:
17
- #
18
- # markdown
19
- # : The markdown format as described by
20
- # http://daringfireball.net/projects/markdown/. See RDoc::Markdown for
21
- # details on the parser and supported extensions.
22
- # rd
23
- # : The rdtool format. See RDoc::RD for details on the parser and format.
24
- # tomdoc
25
- # : The TomDoc format as described by http://tomdoc.org/. See RDoc::TomDoc
26
- # for details on the parser and supported extensions.
16
+ # `RDoc` supports these markup formats:
27
17
  #
18
+ # * `rdoc`: the `RDoc` markup format; see RDoc::MarkupReference.
19
+ # * `markdown`: The `markdown` markup format as described in the [Markdown
20
+ # Guide](https://www.markdownguide.org); see RDoc::Markdown.
21
+ # * `rd`: the `rd` markup format format; see RDoc::RD.
22
+ # * `tomdoc`: the TomDoc format as described in [TomDoc for
23
+ # Ruby](http://tomdoc.org); see RDoc::TomDoc.
28
24
  #
29
25
  # You can choose a markup format using the following methods:
30
26
  #
@@ -36,9 +32,11 @@ module RDoc
36
32
  # rdoc --markup your_favorite_format --write-options
37
33
  #
38
34
  # and commit `.rdoc_options` and ship it with your packaged gem.
35
+ #
39
36
  # per file
40
37
  # : At the top of the file use the `:markup:` directive to set the default
41
38
  # format for the rest of the file.
39
+ #
42
40
  # per comment
43
41
  # : Use the `:markup:` directive at the top of a comment you want to write in
44
42
  # a different format.