rbs 4.0.0.dev.5 → 4.0.1.dev.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 (194) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +1 -0
  3. data/.github/workflows/c-check.yml +8 -4
  4. data/.github/workflows/comments.yml +3 -1
  5. data/.github/workflows/dependabot.yml +1 -1
  6. data/.github/workflows/ruby.yml +10 -0
  7. data/.github/workflows/rust.yml +95 -0
  8. data/CHANGELOG.md +323 -0
  9. data/Rakefile +12 -29
  10. data/Steepfile +1 -0
  11. data/config.yml +393 -37
  12. data/core/array.rbs +218 -188
  13. data/core/basic_object.rbs +9 -8
  14. data/core/class.rbs +6 -5
  15. data/core/comparable.rbs +45 -31
  16. data/core/complex.rbs +52 -40
  17. data/core/dir.rbs +57 -45
  18. data/core/encoding.rbs +5 -5
  19. data/core/enumerable.rbs +96 -91
  20. data/core/enumerator.rbs +4 -3
  21. data/core/errno.rbs +3 -2
  22. data/core/errors.rbs +31 -29
  23. data/core/exception.rbs +12 -12
  24. data/core/fiber.rbs +36 -36
  25. data/core/file.rbs +186 -113
  26. data/core/file_test.rbs +2 -2
  27. data/core/float.rbs +41 -32
  28. data/core/gc.rbs +78 -70
  29. data/core/hash.rbs +70 -60
  30. data/core/integer.rbs +32 -28
  31. data/core/io/buffer.rbs +36 -36
  32. data/core/io/wait.rbs +7 -7
  33. data/core/io.rbs +120 -135
  34. data/core/kernel.rbs +189 -139
  35. data/core/marshal.rbs +3 -3
  36. data/core/match_data.rbs +14 -12
  37. data/core/math.rbs +69 -67
  38. data/core/method.rbs +6 -6
  39. data/core/module.rbs +146 -85
  40. data/core/nil_class.rbs +4 -3
  41. data/core/numeric.rbs +35 -32
  42. data/core/object.rbs +6 -8
  43. data/core/object_space.rbs +11 -10
  44. data/core/pathname.rbs +131 -81
  45. data/core/proc.rbs +65 -33
  46. data/core/process.rbs +219 -201
  47. data/core/ractor.rbs +15 -11
  48. data/core/random.rbs +4 -3
  49. data/core/range.rbs +52 -47
  50. data/core/rational.rbs +5 -5
  51. data/core/rbs/unnamed/argf.rbs +58 -51
  52. data/core/rbs/unnamed/env_class.rbs +18 -13
  53. data/core/rbs/unnamed/main_class.rbs +123 -0
  54. data/core/rbs/unnamed/random.rbs +7 -5
  55. data/core/regexp.rbs +236 -197
  56. data/core/ruby.rbs +1 -1
  57. data/core/ruby_vm.rbs +32 -30
  58. data/core/rubygems/config_file.rbs +5 -5
  59. data/core/rubygems/errors.rbs +1 -1
  60. data/core/rubygems/requirement.rbs +5 -5
  61. data/core/rubygems/rubygems.rbs +5 -3
  62. data/core/set.rbs +17 -16
  63. data/core/signal.rbs +2 -2
  64. data/core/string.rbs +311 -292
  65. data/core/struct.rbs +26 -25
  66. data/core/symbol.rbs +25 -24
  67. data/core/thread.rbs +40 -34
  68. data/core/time.rbs +47 -42
  69. data/core/trace_point.rbs +34 -31
  70. data/core/true_class.rbs +2 -2
  71. data/core/unbound_method.rbs +10 -10
  72. data/core/warning.rbs +7 -7
  73. data/docs/collection.md +1 -1
  74. data/docs/config.md +171 -0
  75. data/docs/inline.md +110 -4
  76. data/docs/syntax.md +13 -12
  77. data/ext/rbs_extension/ast_translation.c +489 -135
  78. data/ext/rbs_extension/class_constants.c +8 -0
  79. data/ext/rbs_extension/class_constants.h +4 -0
  80. data/ext/rbs_extension/legacy_location.c +28 -51
  81. data/ext/rbs_extension/legacy_location.h +37 -0
  82. data/ext/rbs_extension/main.c +12 -20
  83. data/include/rbs/ast.h +423 -195
  84. data/include/rbs/lexer.h +2 -2
  85. data/include/rbs/location.h +25 -44
  86. data/include/rbs/parser.h +2 -2
  87. data/include/rbs/util/rbs_constant_pool.h +0 -3
  88. data/include/rbs.h +8 -0
  89. data/lib/rbs/ast/ruby/annotations.rb +157 -4
  90. data/lib/rbs/ast/ruby/members.rb +374 -22
  91. data/lib/rbs/cli/validate.rb +5 -60
  92. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  93. data/lib/rbs/definition_builder.rb +60 -27
  94. data/lib/rbs/errors.rb +0 -11
  95. data/lib/rbs/inline_parser.rb +1 -1
  96. data/lib/rbs/parser_aux.rb +20 -7
  97. data/lib/rbs/prototype/helpers.rb +57 -0
  98. data/lib/rbs/prototype/rb.rb +1 -26
  99. data/lib/rbs/prototype/rbi.rb +1 -20
  100. data/lib/rbs/test/type_check.rb +3 -0
  101. data/lib/rbs/types.rb +62 -52
  102. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  103. data/lib/rbs/version.rb +1 -1
  104. data/lib/rbs.rb +0 -1
  105. data/rbs.gemspec +1 -1
  106. data/rust/.gitignore +1 -0
  107. data/rust/Cargo.lock +378 -0
  108. data/rust/Cargo.toml +7 -0
  109. data/rust/ruby-rbs/Cargo.toml +22 -0
  110. data/rust/ruby-rbs/build.rs +764 -0
  111. data/rust/ruby-rbs/examples/locations.rs +60 -0
  112. data/rust/ruby-rbs/src/lib.rs +1 -0
  113. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  114. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  115. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  116. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  117. data/rust/ruby-rbs-sys/build.rs +204 -0
  118. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  119. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  120. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  121. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  122. data/sig/ast/ruby/annotations.rbs +191 -4
  123. data/sig/ast/ruby/members.rbs +21 -1
  124. data/sig/cli/validate.rbs +1 -6
  125. data/sig/definition_builder.rbs +2 -0
  126. data/sig/errors.rbs +0 -8
  127. data/sig/method_types.rbs +1 -1
  128. data/sig/parser.rbs +17 -13
  129. data/sig/prototype/helpers.rbs +2 -0
  130. data/sig/types.rbs +10 -11
  131. data/sig/unit_test/spy.rbs +0 -8
  132. data/sig/unit_test/type_assertions.rbs +11 -0
  133. data/src/ast.c +339 -161
  134. data/src/lexstate.c +1 -1
  135. data/src/location.c +7 -47
  136. data/src/parser.c +674 -480
  137. data/src/util/rbs_constant_pool.c +0 -4
  138. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  139. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  140. data/stdlib/coverage/0/coverage.rbs +4 -3
  141. data/stdlib/date/0/date.rbs +33 -28
  142. data/stdlib/date/0/date_time.rbs +24 -23
  143. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  144. data/stdlib/erb/0/erb.rbs +64 -53
  145. data/stdlib/etc/0/etc.rbs +55 -50
  146. data/stdlib/fileutils/0/fileutils.rbs +138 -125
  147. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  148. data/stdlib/io-console/0/io-console.rbs +2 -2
  149. data/stdlib/json/0/json.rbs +135 -108
  150. data/stdlib/monitor/0/monitor.rbs +3 -3
  151. data/stdlib/net-http/0/net-http.rbs +159 -134
  152. data/stdlib/objspace/0/objspace.rbs +8 -7
  153. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  154. data/stdlib/open3/0/open3.rbs +36 -35
  155. data/stdlib/openssl/0/openssl.rbs +144 -129
  156. data/stdlib/optparse/0/optparse.rbs +18 -14
  157. data/stdlib/pathname/0/pathname.rbs +2 -2
  158. data/stdlib/pp/0/pp.rbs +9 -8
  159. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  160. data/stdlib/pstore/0/pstore.rbs +35 -30
  161. data/stdlib/psych/0/psych.rbs +61 -8
  162. data/stdlib/psych/0/store.rbs +2 -4
  163. data/stdlib/pty/0/pty.rbs +9 -6
  164. data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
  165. data/stdlib/ripper/0/ripper.rbs +20 -17
  166. data/stdlib/securerandom/0/securerandom.rbs +1 -1
  167. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  168. data/stdlib/socket/0/addrinfo.rbs +7 -7
  169. data/stdlib/socket/0/basic_socket.rbs +3 -3
  170. data/stdlib/socket/0/ip_socket.rbs +10 -8
  171. data/stdlib/socket/0/socket.rbs +10 -9
  172. data/stdlib/socket/0/tcp_server.rbs +1 -1
  173. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  174. data/stdlib/socket/0/udp_socket.rbs +1 -1
  175. data/stdlib/socket/0/unix_server.rbs +1 -1
  176. data/stdlib/stringio/0/stringio.rbs +55 -54
  177. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  178. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  179. data/stdlib/time/0/time.rbs +7 -5
  180. data/stdlib/tsort/0/tsort.rbs +7 -6
  181. data/stdlib/uri/0/common.rbs +26 -18
  182. data/stdlib/uri/0/file.rbs +2 -2
  183. data/stdlib/uri/0/generic.rbs +2 -2
  184. data/stdlib/uri/0/http.rbs +2 -2
  185. data/stdlib/uri/0/ldap.rbs +2 -2
  186. data/stdlib/uri/0/mailto.rbs +3 -3
  187. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  188. data/stdlib/zlib/0/deflate.rbs +4 -3
  189. data/stdlib/zlib/0/gzip_reader.rbs +4 -4
  190. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  191. data/stdlib/zlib/0/inflate.rbs +1 -1
  192. data/stdlib/zlib/0/need_dict.rbs +1 -1
  193. metadata +23 -5
  194. data/.github/workflows/valgrind.yml +0 -42
data/core/pathname.rbs CHANGED
@@ -193,7 +193,8 @@ class Pathname
193
193
  # rdoc-file=pathname_builtin.rb
194
194
  # - getwd()
195
195
  # -->
196
- # See `Dir.getwd`. Returns the current working directory as a Pathname.
196
+ # See <code>Dir.getwd</code>. Returns the current working directory as a
197
+ # Pathname.
197
198
  #
198
199
  def self.getwd: () -> Pathname
199
200
 
@@ -201,7 +202,7 @@ class Pathname
201
202
  # rdoc-file=pathname_builtin.rb
202
203
  # - glob(*args, **kwargs) { |pathname| ... }
203
204
  # -->
204
- # See `Dir.glob`. Returns or yields Pathname objects.
205
+ # See <code>Dir.glob</code>. Returns or yields Pathname objects.
205
206
  #
206
207
  def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
207
208
  | (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
@@ -253,9 +254,9 @@ class Pathname
253
254
  # Pathname.new('/usr/bin') <=> Pathname.new('/USR/BIN')
254
255
  # #=> 1
255
256
  #
256
- # It will return `-1`, `0` or `1` depending on the value of the left argument
257
- # relative to the right argument. Or it will return `nil` if the arguments are
258
- # not comparable.
257
+ # It will return <code>-1</code>, `0` or `1` depending on the value of the left
258
+ # argument relative to the right argument. Or it will return `nil` if the
259
+ # arguments are not comparable.
259
260
  #
260
261
  def <=>: (Pathname other) -> Integer
261
262
  | (untyped other) -> nil
@@ -265,8 +266,8 @@ class Pathname
265
266
  # - ==(other)
266
267
  # -->
267
268
  # Compare this pathname with `other`. The comparison is string-based. Be aware
268
- # that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
269
- # file.
269
+ # that two different paths (<code>foo.txt</code> and <code>./foo.txt</code>) can
270
+ # refer to the same file.
270
271
  #
271
272
  def ==: (untyped) -> bool
272
273
 
@@ -331,7 +332,7 @@ class Pathname
331
332
  # rdoc-file=pathname_builtin.rb
332
333
  # - atime()
333
334
  # -->
334
- # See `File.atime`. Returns last access time.
335
+ # See <code>File.atime</code>. Returns last access time.
335
336
  #
336
337
  def atime: () -> Time
337
338
 
@@ -339,7 +340,7 @@ class Pathname
339
340
  # rdoc-file=pathname_builtin.rb
340
341
  # - basename(...)
341
342
  # -->
342
- # See `File.basename`. Returns the last component of the path.
343
+ # See <code>File.basename</code>. Returns the last component of the path.
343
344
  #
344
345
  def basename: (?String | _ToStr suffix) -> Pathname
345
346
 
@@ -347,8 +348,8 @@ class Pathname
347
348
  # rdoc-file=pathname_builtin.rb
348
349
  # - binread(...)
349
350
  # -->
350
- # See `File.binread`. Returns all the bytes from the file, or the first `N` if
351
- # specified.
351
+ # See <code>File.binread</code>. Returns all the bytes from the file, or the
352
+ # first `N` if specified.
352
353
  #
353
354
  def binread: (?Integer length, ?Integer offset) -> String
354
355
 
@@ -377,7 +378,7 @@ class Pathname
377
378
  # rdoc-file=pathname_builtin.rb
378
379
  # - blockdev?()
379
380
  # -->
380
- # See `FileTest.blockdev?`.
381
+ # See <code>FileTest.blockdev?</code>.
381
382
  #
382
383
  def blockdev?: () -> bool
383
384
 
@@ -385,7 +386,7 @@ class Pathname
385
386
  # rdoc-file=pathname_builtin.rb
386
387
  # - chardev?()
387
388
  # -->
388
- # See `FileTest.chardev?`.
389
+ # See <code>FileTest.chardev?</code>.
389
390
  #
390
391
  def chardev?: () -> bool
391
392
 
@@ -409,8 +410,8 @@ class Pathname
409
410
  # pn.children(false)
410
411
  # # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
411
412
  #
412
- # Note that the results never contain the entries `.` and `..` in the directory
413
- # because they are not children.
413
+ # Note that the results never contain the entries <code>.</code> and
414
+ # <code>..</code> in the directory because they are not children.
414
415
  #
415
416
  def children: (?boolish with_directory) -> Array[Pathname]
416
417
 
@@ -418,7 +419,7 @@ class Pathname
418
419
  # rdoc-file=pathname_builtin.rb
419
420
  # - chmod(mode)
420
421
  # -->
421
- # See `File.chmod`. Changes permissions.
422
+ # See <code>File.chmod</code>. Changes permissions.
422
423
  #
423
424
  def chmod: (Integer mode_int) -> Integer
424
425
 
@@ -426,7 +427,7 @@ class Pathname
426
427
  # rdoc-file=pathname_builtin.rb
427
428
  # - chown(owner, group)
428
429
  # -->
429
- # See `File.chown`. Change owner and group of file.
430
+ # See <code>File.chown</code>. Change owner and group of file.
430
431
  #
431
432
  def chown: (Integer owner, Integer group) -> Integer
432
433
 
@@ -438,9 +439,9 @@ class Pathname
438
439
  # removed. The filesystem is not accessed.
439
440
  #
440
441
  # If `consider_symlink` is `true`, then a more conservative algorithm is used to
441
- # avoid breaking symbolic linkages. This may retain more `..` entries than
442
- # absolutely necessary, but without accessing the filesystem, this can't be
443
- # avoided.
442
+ # avoid breaking symbolic linkages. This may retain more <code>..</code>
443
+ # entries than absolutely necessary, but without accessing the filesystem, this
444
+ # can't be avoided.
444
445
  #
445
446
  # See Pathname#realpath.
446
447
  #
@@ -450,7 +451,8 @@ class Pathname
450
451
  # rdoc-file=pathname_builtin.rb
451
452
  # - ctime()
452
453
  # -->
453
- # See `File.ctime`. Returns last (directory entry, not file) change time.
454
+ # See <code>File.ctime</code>. Returns last (directory entry, not file) change
455
+ # time.
454
456
  #
455
457
  def ctime: () -> Time
456
458
 
@@ -497,7 +499,7 @@ class Pathname
497
499
  # rdoc-file=pathname_builtin.rb
498
500
  # - directory?()
499
501
  # -->
500
- # See `FileTest.directory?`.
502
+ # See <code>FileTest.directory?</code>.
501
503
  #
502
504
  def directory?: () -> bool
503
505
 
@@ -505,7 +507,8 @@ class Pathname
505
507
  # rdoc-file=pathname_builtin.rb
506
508
  # - dirname()
507
509
  # -->
508
- # See `File.dirname`. Returns all but the last component of the path.
510
+ # See <code>File.dirname</code>. Returns all but the last component of the
511
+ # path.
509
512
  #
510
513
  def dirname: () -> Pathname
511
514
 
@@ -544,8 +547,8 @@ class Pathname
544
547
  # # #<Pathname:src>
545
548
  # # #<Pathname:man>
546
549
  #
547
- # Note that the results never contain the entries `.` and `..` in the directory
548
- # because they are not children.
550
+ # Note that the results never contain the entries <code>.</code> and
551
+ # <code>..</code> in the directory because they are not children.
549
552
  #
550
553
  # See Pathname#children
551
554
  #
@@ -626,7 +629,7 @@ class Pathname
626
629
  # rdoc-file=pathname_builtin.rb
627
630
  # - executable?()
628
631
  # -->
629
- # See `FileTest.executable?`.
632
+ # See <code>FileTest.executable?</code>.
630
633
  #
631
634
  def executable?: () -> bool
632
635
 
@@ -634,7 +637,7 @@ class Pathname
634
637
  # rdoc-file=pathname_builtin.rb
635
638
  # - executable_real?()
636
639
  # -->
637
- # See `FileTest.executable_real?`.
640
+ # See <code>FileTest.executable_real?</code>.
638
641
  #
639
642
  def executable_real?: () -> bool
640
643
 
@@ -642,7 +645,7 @@ class Pathname
642
645
  # rdoc-file=pathname_builtin.rb
643
646
  # - exist?()
644
647
  # -->
645
- # See `FileTest.exist?`.
648
+ # See <code>FileTest.exist?</code>.
646
649
  #
647
650
  def exist?: () -> bool
648
651
 
@@ -650,7 +653,7 @@ class Pathname
650
653
  # rdoc-file=pathname_builtin.rb
651
654
  # - expand_path(...)
652
655
  # -->
653
- # See `File.expand_path`.
656
+ # See <code>File.expand_path</code>.
654
657
  #
655
658
  def expand_path: (?String dir) -> Pathname
656
659
 
@@ -658,7 +661,7 @@ class Pathname
658
661
  # rdoc-file=pathname_builtin.rb
659
662
  # - extname()
660
663
  # -->
661
- # See `File.extname`. Returns the file's extension.
664
+ # See <code>File.extname</code>. Returns the file's extension.
662
665
  #
663
666
  def extname: () -> String
664
667
 
@@ -666,7 +669,7 @@ class Pathname
666
669
  # rdoc-file=pathname_builtin.rb
667
670
  # - file?()
668
671
  # -->
669
- # See `FileTest.file?`.
672
+ # See <code>FileTest.file?</code>.
670
673
  #
671
674
  def file?: () -> bool
672
675
 
@@ -674,7 +677,8 @@ class Pathname
674
677
  # rdoc-file=pathname_builtin.rb
675
678
  # - fnmatch(pattern, ...)
676
679
  # -->
677
- # See `File.fnmatch`. Return `true` if the receiver matches the given pattern.
680
+ # See <code>File.fnmatch</code>. Return `true` if the receiver matches the
681
+ # given pattern.
678
682
  #
679
683
  def fnmatch: (String pattern, ?Integer flags) -> bool
680
684
 
@@ -682,7 +686,7 @@ class Pathname
682
686
  # rdoc-file=pathname_builtin.rb
683
687
  # - fnmatch?(pattern, ...)
684
688
  # -->
685
- # See `File.fnmatch?` (same as #fnmatch).
689
+ # See <code>File.fnmatch?</code> (same as #fnmatch).
686
690
  #
687
691
  alias fnmatch? fnmatch
688
692
 
@@ -698,7 +702,8 @@ class Pathname
698
702
  # rdoc-file=pathname_builtin.rb
699
703
  # - ftype()
700
704
  # -->
701
- # See `File.ftype`. Returns "type" of file ("file", "directory", etc).
705
+ # See <code>File.ftype</code>. Returns "type" of file ("file", "directory",
706
+ # etc).
702
707
  #
703
708
  def ftype: () -> String
704
709
 
@@ -720,7 +725,7 @@ class Pathname
720
725
  # rdoc-file=pathname_builtin.rb
721
726
  # - grpowned?()
722
727
  # -->
723
- # See `FileTest.grpowned?`.
728
+ # See <code>FileTest.grpowned?</code>.
724
729
  #
725
730
  def grpowned?: () -> bool
726
731
 
@@ -749,7 +754,7 @@ class Pathname
749
754
  # rdoc-file=pathname_builtin.rb
750
755
  # - lchmod(mode)
751
756
  # -->
752
- # See `File.lchmod`.
757
+ # See <code>File.lchmod</code>.
753
758
  #
754
759
  def lchmod: (Integer mode) -> Integer
755
760
 
@@ -757,7 +762,7 @@ class Pathname
757
762
  # rdoc-file=pathname_builtin.rb
758
763
  # - lchown(owner, group)
759
764
  # -->
760
- # See `File.lchown`.
765
+ # See <code>File.lchown</code>.
761
766
  #
762
767
  def lchown: (Integer owner, Integer group) -> Integer
763
768
 
@@ -765,7 +770,7 @@ class Pathname
765
770
  # rdoc-file=pathname_builtin.rb
766
771
  # - lstat()
767
772
  # -->
768
- # See `File.lstat`.
773
+ # See <code>File.lstat</code>.
769
774
  #
770
775
  def lstat: () -> ::File::Stat
771
776
 
@@ -785,7 +790,7 @@ class Pathname
785
790
  # rdoc-file=pathname_builtin.rb
786
791
  # - make_link(old)
787
792
  # -->
788
- # See `File.link`. Creates a hard link.
793
+ # See <code>File.link</code>. Creates a hard link.
789
794
  #
790
795
  def make_link: (String | Pathname | _ToStr old) -> Integer
791
796
 
@@ -793,7 +798,7 @@ class Pathname
793
798
  # rdoc-file=pathname_builtin.rb
794
799
  # - make_symlink(old)
795
800
  # -->
796
- # See `File.symlink`. Creates a symbolic link.
801
+ # See <code>File.symlink</code>. Creates a symbolic link.
797
802
  #
798
803
  def make_symlink: (String | Pathname | _ToStr old) -> Integer
799
804
 
@@ -801,7 +806,7 @@ class Pathname
801
806
  # rdoc-file=pathname_builtin.rb
802
807
  # - mkdir(...)
803
808
  # -->
804
- # See `Dir.mkdir`. Create the referenced directory.
809
+ # See <code>Dir.mkdir</code>. Create the referenced directory.
805
810
  #
806
811
  def mkdir: (?Integer perm) -> Integer
807
812
 
@@ -828,7 +833,7 @@ class Pathname
828
833
  # rdoc-file=pathname_builtin.rb
829
834
  # - mtime()
830
835
  # -->
831
- # See `File.mtime`. Returns last modification time.
836
+ # See <code>File.mtime</code>. Returns last modification time.
832
837
  #
833
838
  def mtime: () -> Time
834
839
 
@@ -836,16 +841,59 @@ class Pathname
836
841
  # rdoc-file=pathname_builtin.rb
837
842
  # - open(...) { |file| ... }
838
843
  # -->
839
- # See `File.open`. Opens the file for reading or writing.
840
- #
841
- def open: (?string | int mode, ?int perm) -> File
842
- | [T] (?string | int mode, ?int perm) { (File) -> T } -> T
844
+ # See <code>File.open</code>. Opens the file for reading or writing.
845
+ #
846
+ def open: (
847
+ ?string | int mode,
848
+ ?int perm,
849
+ # open options
850
+ ?flags: Integer,
851
+ ?external_encoding: encoding,
852
+ ?internal_encoding: encoding,
853
+ ?encoding: encoding,
854
+ ?textmode: boolish,
855
+ ?binmode: boolish,
856
+ ?autoclose: boolish,
857
+ ?path: path,
858
+ # encoding options
859
+ ?invalid: :replace | nil,
860
+ ?undef: :replace | nil,
861
+ ?replace: String | nil,
862
+ ?fallback: Hash[string, string] | ^(String) -> string | Method | nil,
863
+ ?xml: :text | :attr | nil,
864
+ ?cr_newline: bool,
865
+ ?crlf_newline: bool,
866
+ ?universal_newline: bool
867
+ ) -> File
868
+ | [T] (
869
+ ?string | int mode,
870
+ ?int perm,
871
+ # open options
872
+ ?mode: Integer | String,
873
+ ?flags: Integer,
874
+ ?external_encoding: encoding,
875
+ ?internal_encoding: encoding,
876
+ ?encoding: encoding,
877
+ ?textmode: boolish,
878
+ ?binmode: boolish,
879
+ ?autoclose: boolish,
880
+ ?path: path,
881
+ # encoding options
882
+ ?invalid: :replace | nil,
883
+ ?undef: :replace | nil,
884
+ ?replace: String | nil,
885
+ ?fallback: Hash[string, string] | ^(String) -> string | Method | nil,
886
+ ?xml: :text | :attr | nil,
887
+ ?cr_newline: bool,
888
+ ?crlf_newline: bool,
889
+ ?universal_newline: bool
890
+ ) { (File) -> T } -> T
843
891
 
844
892
  # <!--
845
893
  # rdoc-file=pathname_builtin.rb
846
894
  # - opendir() { |dir| ... }
847
895
  # -->
848
- # See `Dir.open`.
896
+ # See <code>Dir.open</code>.
849
897
  #
850
898
  def opendir: () -> Dir
851
899
  | [U] () { (Dir) -> U } -> U
@@ -854,7 +902,7 @@ class Pathname
854
902
  # rdoc-file=pathname_builtin.rb
855
903
  # - owned?()
856
904
  # -->
857
- # See `FileTest.owned?`.
905
+ # See <code>FileTest.owned?</code>.
858
906
  #
859
907
  def owned?: () -> bool
860
908
 
@@ -864,7 +912,7 @@ class Pathname
864
912
  # -->
865
913
  # Returns the parent directory.
866
914
  #
867
- # This is same as `self + '..'`.
915
+ # This is same as <code>self + '..'</code>.
868
916
  #
869
917
  def parent: () -> Pathname
870
918
 
@@ -872,7 +920,7 @@ class Pathname
872
920
  # rdoc-file=pathname_builtin.rb
873
921
  # - pipe?()
874
922
  # -->
875
- # See `FileTest.pipe?`.
923
+ # See <code>FileTest.pipe?</code>.
876
924
  #
877
925
  def pipe?: () -> bool
878
926
 
@@ -880,8 +928,8 @@ class Pathname
880
928
  # rdoc-file=pathname_builtin.rb
881
929
  # - read(...)
882
930
  # -->
883
- # See `File.read`. Returns all data from the file, or the first `N` bytes if
884
- # specified.
931
+ # See <code>File.read</code>. Returns all data from the file, or the first `N`
932
+ # bytes if specified.
885
933
  #
886
934
  def read: (?Integer length, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> String
887
935
 
@@ -889,7 +937,7 @@ class Pathname
889
937
  # rdoc-file=pathname_builtin.rb
890
938
  # - readable?()
891
939
  # -->
892
- # See `FileTest.readable?`.
940
+ # See <code>FileTest.readable?</code>.
893
941
  #
894
942
  def readable?: () -> bool
895
943
 
@@ -897,7 +945,7 @@ class Pathname
897
945
  # rdoc-file=pathname_builtin.rb
898
946
  # - readable_real?()
899
947
  # -->
900
- # See `FileTest.readable_real?`.
948
+ # See <code>FileTest.readable_real?</code>.
901
949
  #
902
950
  def readable_real?: () -> bool
903
951
 
@@ -905,7 +953,7 @@ class Pathname
905
953
  # rdoc-file=pathname_builtin.rb
906
954
  # - readlines(...)
907
955
  # -->
908
- # See `File.readlines`. Returns all the lines from the file.
956
+ # See <code>File.readlines</code>. Returns all the lines from the file.
909
957
  #
910
958
  def readlines: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
911
959
  | (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
@@ -914,7 +962,7 @@ class Pathname
914
962
  # rdoc-file=pathname_builtin.rb
915
963
  # - readlink()
916
964
  # -->
917
- # See `File.readlink`. Read symbolic link.
965
+ # See <code>File.readlink</code>. Read symbolic link.
918
966
  #
919
967
  def readlink: () -> untyped
920
968
 
@@ -924,7 +972,7 @@ class Pathname
924
972
  # -->
925
973
  # Returns the real (absolute) pathname of `self` in the actual filesystem.
926
974
  #
927
- # Does not contain symlinks or useless dots, `..` and `.`.
975
+ # Does not contain symlinks or useless dots, <code>..</code> and <code>.</code>.
928
976
  #
929
977
  # The last component of the real pathname can be nonexistent.
930
978
  #
@@ -936,7 +984,7 @@ class Pathname
936
984
  # -->
937
985
  # Returns the real (absolute) pathname for `self` in the actual filesystem.
938
986
  #
939
- # Does not contain symlinks or useless dots, `..` and `.`.
987
+ # Does not contain symlinks or useless dots, <code>..</code> and <code>.</code>.
940
988
  #
941
989
  # All components of the pathname must exist when this method is called.
942
990
  #
@@ -983,7 +1031,7 @@ class Pathname
983
1031
  # rdoc-file=pathname_builtin.rb
984
1032
  # - rename(to)
985
1033
  # -->
986
- # See `File.rename`. Rename the file.
1034
+ # See <code>File.rename</code>. Rename the file.
987
1035
  #
988
1036
  def rename: (Pathname | string new_name) -> 0
989
1037
 
@@ -991,7 +1039,7 @@ class Pathname
991
1039
  # rdoc-file=pathname_builtin.rb
992
1040
  # - rmdir()
993
1041
  # -->
994
- # See `Dir.rmdir`. Remove the referenced directory.
1042
+ # See <code>Dir.rmdir</code>. Remove the referenced directory.
995
1043
  #
996
1044
  def rmdir: () -> 0
997
1045
 
@@ -1003,7 +1051,7 @@ class Pathname
1003
1051
  # consists of consecutive slashes.
1004
1052
  #
1005
1053
  # It doesn't access the filesystem. So it may return `false` for some pathnames
1006
- # which points to roots such as `/usr/..`.
1054
+ # which points to roots such as <code>/usr/..</code>.
1007
1055
  #
1008
1056
  def root?: () -> bool
1009
1057
 
@@ -1011,7 +1059,7 @@ class Pathname
1011
1059
  # rdoc-file=pathname_builtin.rb
1012
1060
  # - setgid?()
1013
1061
  # -->
1014
- # See `FileTest.setgid?`.
1062
+ # See <code>FileTest.setgid?</code>.
1015
1063
  #
1016
1064
  def setgid?: () -> bool
1017
1065
 
@@ -1019,7 +1067,7 @@ class Pathname
1019
1067
  # rdoc-file=pathname_builtin.rb
1020
1068
  # - setuid?()
1021
1069
  # -->
1022
- # See `FileTest.setuid?`.
1070
+ # See <code>FileTest.setuid?</code>.
1023
1071
  #
1024
1072
  def setuid?: () -> bool
1025
1073
 
@@ -1027,7 +1075,7 @@ class Pathname
1027
1075
  # rdoc-file=pathname_builtin.rb
1028
1076
  # - size()
1029
1077
  # -->
1030
- # See `FileTest.size`.
1078
+ # See <code>FileTest.size</code>.
1031
1079
  #
1032
1080
  def size: () -> Integer
1033
1081
 
@@ -1035,7 +1083,7 @@ class Pathname
1035
1083
  # rdoc-file=pathname_builtin.rb
1036
1084
  # - size?()
1037
1085
  # -->
1038
- # See `FileTest.size?`.
1086
+ # See <code>FileTest.size?</code>.
1039
1087
  #
1040
1088
  def size?: () -> Integer?
1041
1089
 
@@ -1043,7 +1091,7 @@ class Pathname
1043
1091
  # rdoc-file=pathname_builtin.rb
1044
1092
  # - socket?()
1045
1093
  # -->
1046
- # See `FileTest.socket?`.
1094
+ # See <code>FileTest.socket?</code>.
1047
1095
  #
1048
1096
  def socket?: () -> untyped
1049
1097
 
@@ -1051,7 +1099,8 @@ class Pathname
1051
1099
  # rdoc-file=pathname_builtin.rb
1052
1100
  # - split()
1053
1101
  # -->
1054
- # See `File.split`. Returns the #dirname and the #basename in an Array.
1102
+ # See <code>File.split</code>. Returns the #dirname and the #basename in an
1103
+ # Array.
1055
1104
  #
1056
1105
  def split: () -> [ Pathname, Pathname ]
1057
1106
 
@@ -1059,7 +1108,7 @@ class Pathname
1059
1108
  # rdoc-file=pathname_builtin.rb
1060
1109
  # - stat()
1061
1110
  # -->
1062
- # See `File.stat`. Returns a `File::Stat` object.
1111
+ # See <code>File.stat</code>. Returns a <code>File::Stat</code> object.
1063
1112
  #
1064
1113
  def stat: () -> File::Stat
1065
1114
 
@@ -1067,7 +1116,7 @@ class Pathname
1067
1116
  # rdoc-file=pathname_builtin.rb
1068
1117
  # - sticky?()
1069
1118
  # -->
1070
- # See `FileTest.sticky?`.
1119
+ # See <code>FileTest.sticky?</code>.
1071
1120
  #
1072
1121
  def sticky?: () -> untyped
1073
1122
 
@@ -1101,7 +1150,7 @@ class Pathname
1101
1150
  # rdoc-file=pathname_builtin.rb
1102
1151
  # - symlink?()
1103
1152
  # -->
1104
- # See `FileTest.symlink?`.
1153
+ # See <code>FileTest.symlink?</code>.
1105
1154
  #
1106
1155
  def symlink?: () -> untyped
1107
1156
 
@@ -1109,7 +1158,7 @@ class Pathname
1109
1158
  # rdoc-file=pathname_builtin.rb
1110
1159
  # - sysopen(...)
1111
1160
  # -->
1112
- # See `File.sysopen`.
1161
+ # See <code>File.sysopen</code>.
1113
1162
  #
1114
1163
  def sysopen: (?String mode, ?Integer perm) -> Integer
1115
1164
 
@@ -1138,7 +1187,7 @@ class Pathname
1138
1187
  # rdoc-file=pathname_builtin.rb
1139
1188
  # - truncate(length)
1140
1189
  # -->
1141
- # See `File.truncate`. Truncate the file to `length` bytes.
1190
+ # See <code>File.truncate</code>. Truncate the file to `length` bytes.
1142
1191
  #
1143
1192
  def truncate: (Integer length) -> 0
1144
1193
 
@@ -1146,7 +1195,8 @@ class Pathname
1146
1195
  # rdoc-file=pathname_builtin.rb
1147
1196
  # - unlink()
1148
1197
  # -->
1149
- # Removes a file or directory, using `File.unlink` or `Dir.unlink` as necessary.
1198
+ # Removes a file or directory, using <code>File.unlink</code> or
1199
+ # <code>Dir.unlink</code> as necessary.
1150
1200
  #
1151
1201
  def unlink: () -> Integer
1152
1202
 
@@ -1162,7 +1212,7 @@ class Pathname
1162
1212
  # rdoc-file=pathname_builtin.rb
1163
1213
  # - utime(atime, mtime)
1164
1214
  # -->
1165
- # See `File.utime`. Update the access and modification times.
1215
+ # See <code>File.utime</code>. Update the access and modification times.
1166
1216
  #
1167
1217
  def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
1168
1218
 
@@ -1170,7 +1220,7 @@ class Pathname
1170
1220
  # rdoc-file=pathname_builtin.rb
1171
1221
  # - world_readable?()
1172
1222
  # -->
1173
- # See `FileTest.world_readable?`.
1223
+ # See <code>FileTest.world_readable?</code>.
1174
1224
  #
1175
1225
  def world_readable?: () -> (Integer | nil)
1176
1226
 
@@ -1178,7 +1228,7 @@ class Pathname
1178
1228
  # rdoc-file=pathname_builtin.rb
1179
1229
  # - world_writable?()
1180
1230
  # -->
1181
- # See `FileTest.world_writable?`.
1231
+ # See <code>FileTest.world_writable?</code>.
1182
1232
  #
1183
1233
  def world_writable?: () -> (Integer | nil)
1184
1234
 
@@ -1186,7 +1236,7 @@ class Pathname
1186
1236
  # rdoc-file=pathname_builtin.rb
1187
1237
  # - writable?()
1188
1238
  # -->
1189
- # See `FileTest.writable?`.
1239
+ # See <code>FileTest.writable?</code>.
1190
1240
  #
1191
1241
  def writable?: () -> bool
1192
1242
 
@@ -1194,7 +1244,7 @@ class Pathname
1194
1244
  # rdoc-file=pathname_builtin.rb
1195
1245
  # - writable_real?()
1196
1246
  # -->
1197
- # See `FileTest.writable_real?`.
1247
+ # See <code>FileTest.writable_real?</code>.
1198
1248
  #
1199
1249
  def writable_real?: () -> bool
1200
1250
 
@@ -1202,7 +1252,7 @@ class Pathname
1202
1252
  # rdoc-file=pathname_builtin.rb
1203
1253
  # - write(...)
1204
1254
  # -->
1205
- # Writes `contents` to the file. See `File.write`.
1255
+ # Writes `contents` to the file. See <code>File.write</code>.
1206
1256
  #
1207
1257
  def write: (String content, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> Integer
1208
1258
 
@@ -1210,7 +1260,7 @@ class Pathname
1210
1260
  # rdoc-file=pathname_builtin.rb
1211
1261
  # - zero?()
1212
1262
  # -->
1213
- # See `FileTest.zero?`.
1263
+ # See <code>FileTest.zero?</code>.
1214
1264
  #
1215
1265
  def zero?: () -> bool
1216
1266
 
@@ -1233,7 +1283,7 @@ class Pathname
1233
1283
  # - new(path)
1234
1284
  # -->
1235
1285
  # Create a Pathname object from the given String (or String-like object). If
1236
- # `path` contains a NUL character (`\0`), an ArgumentError is raised.
1286
+ # `path` contains a NUL character (<code>\0</code>), an ArgumentError is raised.
1237
1287
  #
1238
1288
  def initialize: (string | Pathname) -> void
1239
1289