rbs 3.9.5 → 3.10.0.pre.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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +74 -0
  3. data/.clangd +2 -0
  4. data/.github/workflows/c-check.yml +54 -0
  5. data/.github/workflows/comments.yml +3 -3
  6. data/.github/workflows/ruby.yml +34 -19
  7. data/.github/workflows/typecheck.yml +1 -1
  8. data/.github/workflows/windows.yml +1 -1
  9. data/.gitignore +4 -0
  10. data/README.md +38 -1
  11. data/Rakefile +152 -23
  12. data/config.yml +190 -62
  13. data/core/array.rbs +44 -43
  14. data/core/dir.rbs +2 -2
  15. data/core/encoding.rbs +3 -2
  16. data/core/enumerable.rbs +89 -2
  17. data/core/errno.rbs +8 -0
  18. data/core/errors.rbs +28 -1
  19. data/core/exception.rbs +2 -2
  20. data/core/fiber.rbs +3 -3
  21. data/core/file.rbs +26 -11
  22. data/core/float.rbs +1 -1
  23. data/core/gc.rbs +422 -281
  24. data/core/hash.rbs +1024 -727
  25. data/core/io/wait.rbs +11 -33
  26. data/core/io.rbs +6 -4
  27. data/core/kernel.rbs +49 -43
  28. data/core/marshal.rbs +1 -1
  29. data/core/match_data.rbs +1 -1
  30. data/core/math.rbs +42 -3
  31. data/core/method.rbs +14 -6
  32. data/core/module.rbs +71 -11
  33. data/core/nil_class.rbs +3 -3
  34. data/core/numeric.rbs +8 -8
  35. data/core/object.rbs +3 -3
  36. data/core/object_space.rbs +13 -0
  37. data/{stdlib/pathname/0 → core}/pathname.rbs +253 -352
  38. data/core/proc.rbs +15 -8
  39. data/core/process.rbs +2 -2
  40. data/core/ractor.rbs +278 -437
  41. data/core/range.rbs +6 -7
  42. data/core/rbs/unnamed/argf.rbs +1 -1
  43. data/core/rbs/unnamed/env_class.rbs +1 -1
  44. data/core/rbs/unnamed/random.rbs +4 -2
  45. data/core/regexp.rbs +22 -17
  46. data/core/ruby_vm.rbs +6 -4
  47. data/core/rubygems/errors.rbs +3 -70
  48. data/core/rubygems/rubygems.rbs +11 -79
  49. data/core/set.rbs +439 -332
  50. data/core/string.rbs +2897 -1117
  51. data/core/struct.rbs +1 -1
  52. data/core/symbol.rbs +4 -4
  53. data/core/thread.rbs +83 -20
  54. data/core/time.rbs +35 -9
  55. data/core/unbound_method.rbs +14 -6
  56. data/docs/aliases.md +79 -0
  57. data/docs/collection.md +2 -2
  58. data/docs/gem.md +0 -1
  59. data/docs/sigs.md +3 -3
  60. data/ext/rbs_extension/ast_translation.c +1016 -0
  61. data/ext/rbs_extension/ast_translation.h +37 -0
  62. data/ext/rbs_extension/class_constants.c +157 -0
  63. data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
  64. data/ext/rbs_extension/compat.h +10 -0
  65. data/ext/rbs_extension/extconf.rb +25 -1
  66. data/ext/rbs_extension/legacy_location.c +317 -0
  67. data/ext/rbs_extension/legacy_location.h +45 -0
  68. data/ext/rbs_extension/main.c +365 -14
  69. data/ext/rbs_extension/rbs_extension.h +6 -21
  70. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  71. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  72. data/include/rbs/ast.h +687 -0
  73. data/include/rbs/defines.h +86 -0
  74. data/include/rbs/lexer.h +199 -0
  75. data/include/rbs/location.h +59 -0
  76. data/include/rbs/parser.h +135 -0
  77. data/include/rbs/string.h +49 -0
  78. data/include/rbs/util/rbs_allocator.h +59 -0
  79. data/include/rbs/util/rbs_assert.h +20 -0
  80. data/include/rbs/util/rbs_buffer.h +83 -0
  81. data/include/rbs/util/rbs_constant_pool.h +6 -67
  82. data/include/rbs/util/rbs_encoding.h +282 -0
  83. data/include/rbs/util/rbs_unescape.h +23 -0
  84. data/include/rbs.h +1 -2
  85. data/lib/rbs/annotate/formatter.rb +3 -13
  86. data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
  87. data/lib/rbs/annotate/rdoc_source.rb +1 -1
  88. data/lib/rbs/cli/validate.rb +2 -2
  89. data/lib/rbs/cli.rb +1 -1
  90. data/lib/rbs/collection/config/lockfile_generator.rb +1 -0
  91. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
  92. data/lib/rbs/environment.rb +64 -59
  93. data/lib/rbs/environment_loader.rb +1 -1
  94. data/lib/rbs/errors.rb +1 -1
  95. data/lib/rbs/parser_aux.rb +5 -0
  96. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  97. data/lib/rbs/resolver/type_name_resolver.rb +124 -38
  98. data/lib/rbs/test/type_check.rb +13 -0
  99. data/lib/rbs/types.rb +3 -1
  100. data/lib/rbs/version.rb +1 -1
  101. data/lib/rbs.rb +1 -1
  102. data/lib/rdoc/discover.rb +1 -1
  103. data/lib/rdoc_plugin/parser.rb +3 -3
  104. data/sig/annotate/formatter.rbs +2 -2
  105. data/sig/annotate/rdoc_annotater.rbs +1 -1
  106. data/sig/environment.rbs +57 -6
  107. data/sig/manifest.yaml +0 -1
  108. data/sig/parser.rbs +20 -0
  109. data/sig/resolver/type_name_resolver.rbs +38 -7
  110. data/sig/types.rbs +4 -1
  111. data/src/ast.c +1256 -0
  112. data/src/lexer.c +2956 -0
  113. data/src/lexer.re +147 -0
  114. data/src/lexstate.c +205 -0
  115. data/src/location.c +71 -0
  116. data/src/parser.c +3495 -0
  117. data/src/string.c +90 -0
  118. data/src/util/rbs_allocator.c +152 -0
  119. data/src/util/rbs_assert.c +21 -0
  120. data/src/util/rbs_buffer.c +54 -0
  121. data/src/util/rbs_constant_pool.c +16 -86
  122. data/src/util/rbs_encoding.c +21308 -0
  123. data/src/util/rbs_unescape.c +131 -0
  124. data/stdlib/cgi/0/core.rbs +2 -396
  125. data/stdlib/cgi/0/manifest.yaml +1 -0
  126. data/stdlib/cgi-escape/0/escape.rbs +153 -0
  127. data/stdlib/coverage/0/coverage.rbs +3 -1
  128. data/stdlib/delegate/0/delegator.rbs +10 -7
  129. data/stdlib/erb/0/erb.rbs +737 -347
  130. data/stdlib/fileutils/0/fileutils.rbs +18 -13
  131. data/stdlib/forwardable/0/forwardable.rbs +3 -0
  132. data/stdlib/json/0/json.rbs +67 -48
  133. data/stdlib/net-http/0/net-http.rbs +3 -0
  134. data/stdlib/objspace/0/objspace.rbs +8 -3
  135. data/stdlib/open-uri/0/open-uri.rbs +40 -0
  136. data/stdlib/openssl/0/openssl.rbs +182 -149
  137. data/stdlib/optparse/0/optparse.rbs +3 -3
  138. data/stdlib/rdoc/0/code_object.rbs +2 -2
  139. data/stdlib/rdoc/0/comment.rbs +2 -0
  140. data/stdlib/rdoc/0/options.rbs +76 -0
  141. data/stdlib/rdoc/0/rdoc.rbs +7 -5
  142. data/stdlib/rdoc/0/store.rbs +1 -1
  143. data/stdlib/resolv/0/resolv.rbs +25 -68
  144. data/stdlib/ripper/0/ripper.rbs +5 -2
  145. data/stdlib/singleton/0/singleton.rbs +3 -0
  146. data/stdlib/socket/0/socket.rbs +13 -1
  147. data/stdlib/socket/0/tcp_socket.rbs +10 -2
  148. data/stdlib/stringio/0/stringio.rbs +412 -80
  149. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  150. data/stdlib/tempfile/0/tempfile.rbs +1 -1
  151. data/stdlib/tsort/0/cyclic.rbs +3 -0
  152. data/stdlib/uri/0/common.rbs +11 -2
  153. data/stdlib/uri/0/file.rbs +1 -1
  154. data/stdlib/uri/0/generic.rbs +16 -15
  155. data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
  156. data/stdlib/zlib/0/zstream.rbs +1 -0
  157. metadata +41 -18
  158. data/ext/rbs_extension/lexer.c +0 -2728
  159. data/ext/rbs_extension/lexer.h +0 -179
  160. data/ext/rbs_extension/lexer.re +0 -147
  161. data/ext/rbs_extension/lexstate.c +0 -175
  162. data/ext/rbs_extension/location.c +0 -325
  163. data/ext/rbs_extension/location.h +0 -85
  164. data/ext/rbs_extension/parser.c +0 -2982
  165. data/ext/rbs_extension/parser.h +0 -18
  166. data/ext/rbs_extension/parserstate.c +0 -411
  167. data/ext/rbs_extension/parserstate.h +0 -163
  168. data/ext/rbs_extension/unescape.c +0 -32
  169. data/include/rbs/ruby_objs.h +0 -72
  170. data/src/constants.c +0 -153
  171. data/src/ruby_objs.c +0 -799
@@ -1,4 +1,18 @@
1
- # <!-- rdoc-file=ext/pathname/pathname.c -->
1
+ # <!-- rdoc-file=lib/pathname.rb -->
2
+ # # pathname.rb
3
+ #
4
+ # Object-Oriented Pathname Class
5
+ #
6
+ # Author
7
+ # : Tanaka Akira <akr@m17n.org>
8
+ #
9
+ # Documentation
10
+ # : Author and Gavin Sinclair
11
+ #
12
+ #
13
+ # For documentation, see class Pathname.
14
+ #
15
+ # <!-- rdoc-file=pathname_builtin.rb -->
2
16
  # Pathname represents the name of a file or directory on the filesystem, but not
3
17
  # the file itself.
4
18
  #
@@ -113,6 +127,13 @@
113
127
  # ### File property and manipulation methods
114
128
  #
115
129
  # These methods are a facade for File:
130
+ # * #each_line(*args, &block)
131
+ # * #read(*args)
132
+ # * #binread(*args)
133
+ # * #readlines(*args)
134
+ # * #sysopen(*args)
135
+ # * #write(*args)
136
+ # * #binwrite(*args)
116
137
  # * #atime
117
138
  # * #birthtime
118
139
  # * #ctime
@@ -151,17 +172,6 @@
151
172
  # * #mkdir(*args)
152
173
  # * #opendir(*args)
153
174
  #
154
- # ### IO
155
- #
156
- # These methods are a facade for IO:
157
- # * #each_line(*args, &block)
158
- # * #read(*args)
159
- # * #binread(*args)
160
- # * #readlines(*args)
161
- # * #sysopen(*args)
162
- # * #write(*args)
163
- # * #binwrite(*args)
164
- #
165
175
  # ### Utilities
166
176
  #
167
177
  # These methods are a mixture of Find, FileUtils, and others:
@@ -180,47 +190,31 @@
180
190
  #
181
191
  class Pathname
182
192
  # <!--
183
- # rdoc-file=ext/pathname/pathname.c
193
+ # rdoc-file=pathname_builtin.rb
184
194
  # - getwd()
185
195
  # -->
186
- # Returns the current working directory as a Pathname.
187
- #
188
- # Pathname.getwd
189
- # #=> #<Pathname:/home/zzak/projects/ruby>
190
- #
191
- # See Dir.getwd.
196
+ # See `Dir.getwd`. Returns the current working directory as a Pathname.
192
197
  #
193
198
  def self.getwd: () -> Pathname
194
199
 
195
200
  # <!--
196
- # rdoc-file=ext/pathname/pathname.c
197
- # - glob(p1, p2 = v2, p3 = v3)
201
+ # rdoc-file=pathname_builtin.rb
202
+ # - glob(*args, **kwargs) { |pathname| ... }
198
203
  # -->
199
- # Returns or yields Pathname objects.
200
- #
201
- # Pathname.glob("lib/i*.rb")
202
- # #=> [#<Pathname:lib/ipaddr.rb>, #<Pathname:lib/irb.rb>]
203
- #
204
- # See Dir.glob.
204
+ # See `Dir.glob`. Returns or yields Pathname objects.
205
205
  #
206
206
  def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
207
207
  | (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
208
208
 
209
209
  # <!--
210
- # rdoc-file=ext/pathname/pathname.c
210
+ # rdoc-file=pathname_builtin.rb
211
211
  # - pwd()
212
212
  # -->
213
- # Returns the current working directory as a Pathname.
214
- #
215
- # Pathname.getwd
216
- # #=> #<Pathname:/home/zzak/projects/ruby>
217
- #
218
- # See Dir.getwd.
219
213
  #
220
214
  def self.pwd: () -> Pathname
221
215
 
222
216
  # <!--
223
- # rdoc-file=ext/pathname/lib/pathname.rb
217
+ # rdoc-file=pathname_builtin.rb
224
218
  # - +(other)
225
219
  # -->
226
220
  # Appends a pathname fragment to `self` to produce a new Pathname object. Since
@@ -240,14 +234,14 @@ class Pathname
240
234
  def +: (Pathname | String | _ToStr other) -> Pathname
241
235
 
242
236
  # <!--
243
- # rdoc-file=ext/pathname/lib/pathname.rb
237
+ # rdoc-file=pathname_builtin.rb
244
238
  # - /(other)
245
239
  # -->
246
240
  #
247
241
  alias / +
248
242
 
249
243
  # <!--
250
- # rdoc-file=ext/pathname/pathname.c
244
+ # rdoc-file=pathname.c
251
245
  # - <=>(p1)
252
246
  # -->
253
247
  # Provides a case-sensitive comparison operator for pathnames.
@@ -267,8 +261,8 @@ class Pathname
267
261
  | (untyped other) -> nil
268
262
 
269
263
  # <!--
270
- # rdoc-file=ext/pathname/pathname.c
271
- # - ==(p1)
264
+ # rdoc-file=pathname_builtin.rb
265
+ # - ==(other)
272
266
  # -->
273
267
  # Compare this pathname with `other`. The comparison is string-based. Be aware
274
268
  # that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
@@ -276,15 +270,15 @@ class Pathname
276
270
  #
277
271
  def ==: (untyped) -> bool
278
272
 
279
- # <!-- rdoc-file=ext/pathname/pathname.c -->
280
- # Compare this pathname with `other`. The comparison is string-based. Be aware
281
- # that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
282
- # file.
273
+ # <!--
274
+ # rdoc-file=pathname_builtin.rb
275
+ # - ===(other)
276
+ # -->
283
277
  #
284
278
  def ===: (untyped) -> bool
285
279
 
286
280
  # <!--
287
- # rdoc-file=ext/pathname/lib/pathname.rb
281
+ # rdoc-file=pathname_builtin.rb
288
282
  # - absolute?()
289
283
  # -->
290
284
  # Predicate method for testing whether a path is absolute.
@@ -302,7 +296,7 @@ class Pathname
302
296
  def absolute?: () -> bool
303
297
 
304
298
  # <!--
305
- # rdoc-file=ext/pathname/lib/pathname.rb
299
+ # rdoc-file=pathname_builtin.rb
306
300
  # - ascend() { |self| ... }
307
301
  # -->
308
302
  # Iterates over and yields a new Pathname object for each element in the given
@@ -334,39 +328,33 @@ class Pathname
334
328
  | () -> Enumerator[Pathname, nil]
335
329
 
336
330
  # <!--
337
- # rdoc-file=ext/pathname/pathname.c
338
- # - pathname.atime -> time
331
+ # rdoc-file=pathname_builtin.rb
332
+ # - atime()
339
333
  # -->
340
- # Returns the last access time for the file.
341
- #
342
- # See File.atime.
334
+ # See `File.atime`. Returns last access time.
343
335
  #
344
336
  def atime: () -> Time
345
337
 
346
338
  # <!--
347
- # rdoc-file=ext/pathname/pathname.c
348
- # - basename(p1 = v1)
339
+ # rdoc-file=pathname_builtin.rb
340
+ # - basename(...)
349
341
  # -->
350
- # Returns the last component of the path.
351
- #
352
- # See File.basename.
342
+ # See `File.basename`. Returns the last component of the path.
353
343
  #
354
344
  def basename: (?String | _ToStr suffix) -> Pathname
355
345
 
356
346
  # <!--
357
- # rdoc-file=ext/pathname/pathname.c
358
- # - pathname.binread([length [, offset]]) -> string
347
+ # rdoc-file=pathname_builtin.rb
348
+ # - binread(...)
359
349
  # -->
360
- # Returns all the bytes from the file, or the first `N` if specified.
361
- #
362
- # See File.binread.
350
+ # See `File.binread`. Returns all the bytes from the file, or the first `N` if
351
+ # specified.
363
352
  #
364
353
  def binread: (?Integer length, ?Integer offset) -> String
365
354
 
366
355
  # <!--
367
- # rdoc-file=ext/pathname/pathname.c
368
- # - pathname.binwrite(string, [offset] ) => fixnum
369
- # - pathname.binwrite(string, [offset], open_args ) => fixnum
356
+ # rdoc-file=pathname_builtin.rb
357
+ # - binwrite(...)
370
358
  # -->
371
359
  # Writes `contents` to the file, opening it in binary mode.
372
360
  #
@@ -375,8 +363,8 @@ class Pathname
375
363
  def binwrite: (String, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?invalid: :replace ?, ?undef: :replace ?, ?replace: String, ?fallback: Hash[String, String] | Proc | Method, ?xml: :text | :attr, ?universal_newline: true, ?cr_newline: true, ?crlf_newline: true) -> Integer
376
364
 
377
365
  # <!--
378
- # rdoc-file=ext/pathname/pathname.c
379
- # - pathname.birthtime -> time
366
+ # rdoc-file=pathname_builtin.rb
367
+ # - birthtime()
380
368
  # -->
381
369
  # Returns the birth time for the file. If the platform doesn't have birthtime,
382
370
  # raises NotImplementedError.
@@ -386,23 +374,23 @@ class Pathname
386
374
  def birthtime: () -> Time
387
375
 
388
376
  # <!--
389
- # rdoc-file=ext/pathname/pathname.c
377
+ # rdoc-file=pathname_builtin.rb
390
378
  # - blockdev?()
391
379
  # -->
392
- # See FileTest.blockdev?.
380
+ # See `FileTest.blockdev?`.
393
381
  #
394
382
  def blockdev?: () -> bool
395
383
 
396
384
  # <!--
397
- # rdoc-file=ext/pathname/pathname.c
385
+ # rdoc-file=pathname_builtin.rb
398
386
  # - chardev?()
399
387
  # -->
400
- # See FileTest.chardev?.
388
+ # See `FileTest.chardev?`.
401
389
  #
402
390
  def chardev?: () -> bool
403
391
 
404
392
  # <!--
405
- # rdoc-file=ext/pathname/lib/pathname.rb
393
+ # rdoc-file=pathname_builtin.rb
406
394
  # - children(with_directory=true)
407
395
  # -->
408
396
  # Returns the children of the directory (files and subdirectories, not
@@ -427,27 +415,23 @@ class Pathname
427
415
  def children: (?boolish with_directory) -> Array[Pathname]
428
416
 
429
417
  # <!--
430
- # rdoc-file=ext/pathname/pathname.c
431
- # - pathname.chmod(mode_int) -> integer
418
+ # rdoc-file=pathname_builtin.rb
419
+ # - chmod(mode)
432
420
  # -->
433
- # Changes file permissions.
434
- #
435
- # See File.chmod.
421
+ # See `File.chmod`. Changes permissions.
436
422
  #
437
423
  def chmod: (Integer mode_int) -> Integer
438
424
 
439
425
  # <!--
440
- # rdoc-file=ext/pathname/pathname.c
441
- # - pathname.chown(owner_int, group_int) -> integer
426
+ # rdoc-file=pathname_builtin.rb
427
+ # - chown(owner, group)
442
428
  # -->
443
- # Change owner and group of the file.
444
- #
445
- # See File.chown.
429
+ # See `File.chown`. Change owner and group of file.
446
430
  #
447
431
  def chown: (Integer owner, Integer group) -> Integer
448
432
 
449
433
  # <!--
450
- # rdoc-file=ext/pathname/lib/pathname.rb
434
+ # rdoc-file=pathname_builtin.rb
451
435
  # - cleanpath(consider_symlink=false)
452
436
  # -->
453
437
  # Returns clean pathname of `self` with consecutive slashes and useless dots
@@ -463,24 +447,22 @@ class Pathname
463
447
  def cleanpath: (?boolish consider_symlink) -> Pathname
464
448
 
465
449
  # <!--
466
- # rdoc-file=ext/pathname/pathname.c
467
- # - pathname.ctime -> time
450
+ # rdoc-file=pathname_builtin.rb
451
+ # - ctime()
468
452
  # -->
469
- # Returns the last change time, using directory information, not the file
470
- # itself.
471
- #
472
- # See File.ctime.
453
+ # See `File.ctime`. Returns last (directory entry, not file) change time.
473
454
  #
474
455
  def ctime: () -> Time
475
456
 
476
- # <!-- rdoc-file=ext/pathname/pathname.c -->
477
- # Removes a file or directory, using File.unlink if `self` is a file, or
478
- # Dir.unlink as necessary.
457
+ # <!--
458
+ # rdoc-file=pathname_builtin.rb
459
+ # - delete()
460
+ # -->
479
461
  #
480
462
  def delete: () -> Integer
481
463
 
482
464
  # <!--
483
- # rdoc-file=ext/pathname/lib/pathname.rb
465
+ # rdoc-file=pathname_builtin.rb
484
466
  # - descend() { |v| ... }
485
467
  # -->
486
468
  # Iterates over and yields a new Pathname object for each element in the given
@@ -512,25 +494,23 @@ class Pathname
512
494
  | () -> Enumerator[Pathname, nil]
513
495
 
514
496
  # <!--
515
- # rdoc-file=ext/pathname/pathname.c
497
+ # rdoc-file=pathname_builtin.rb
516
498
  # - directory?()
517
499
  # -->
518
- # See FileTest.directory?.
500
+ # See `FileTest.directory?`.
519
501
  #
520
502
  def directory?: () -> bool
521
503
 
522
504
  # <!--
523
- # rdoc-file=ext/pathname/pathname.c
505
+ # rdoc-file=pathname_builtin.rb
524
506
  # - dirname()
525
507
  # -->
526
- # Returns all but the last component of the path.
527
- #
528
- # See File.dirname.
508
+ # See `File.dirname`. Returns all but the last component of the path.
529
509
  #
530
510
  def dirname: () -> Pathname
531
511
 
532
512
  # <!--
533
- # rdoc-file=ext/pathname/lib/pathname.rb
513
+ # rdoc-file=pathname_builtin.rb
534
514
  # - each_child(with_directory=true, &b)
535
515
  # -->
536
516
  # Iterates over the children of the directory (files and subdirectories, not
@@ -573,16 +553,18 @@ class Pathname
573
553
  | (?boolish with_directory) -> Enumerator[Pathname, Array[Pathname]]
574
554
 
575
555
  # <!--
576
- # rdoc-file=ext/pathname/pathname.c
577
- # - each_entry()
556
+ # rdoc-file=pathname_builtin.rb
557
+ # - each_entry() { |pathname| ... }
578
558
  # -->
579
- # Iterates over the entries (files and subdirectories) in the directory,
580
- # yielding a Pathname object for each entry.
559
+ # Iterates over the entries (files and subdirectories) in the directory. It
560
+ # yields a Pathname object for each entry.
561
+ #
562
+ # This method has existed since 1.8.1.
581
563
  #
582
564
  def each_entry: () { (Pathname) -> untyped } -> nil
583
565
 
584
566
  # <!--
585
- # rdoc-file=ext/pathname/lib/pathname.rb
567
+ # rdoc-file=pathname_builtin.rb
586
568
  # - each_filename() { |filename| ... }
587
569
  # -->
588
570
  # Iterates over each component of the path.
@@ -601,14 +583,13 @@ class Pathname
601
583
  | () -> Enumerator[String, nil]
602
584
 
603
585
  # <!--
604
- # rdoc-file=ext/pathname/pathname.c
605
- # - pathname.each_line {|line| ... }
606
- # - pathname.each_line(sep=$/ [, open_args]) {|line| block } -> nil
607
- # - pathname.each_line(limit [, open_args]) {|line| block } -> nil
608
- # - pathname.each_line(sep, limit [, open_args]) {|line| block } -> nil
609
- # - pathname.each_line(...) -> an_enumerator
586
+ # rdoc-file=pathname_builtin.rb
587
+ # - each_line(...) { |line| ... }
610
588
  # -->
611
- # Iterates over each line in the file and yields a String object for each.
589
+ # #each_line iterates over the line in the file. It yields a String object for
590
+ # each line.
591
+ #
592
+ # This method has existed since 1.8.1.
612
593
  #
613
594
  def each_line: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) { (String) -> untyped } -> nil
614
595
  | (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) { (String) -> untyped } -> nil
@@ -616,7 +597,7 @@ class Pathname
616
597
  | (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Enumerator[String, nil]
617
598
 
618
599
  # <!--
619
- # rdoc-file=ext/pathname/pathname.c
600
+ # rdoc-file=pathname_builtin.rb
620
601
  # - empty?()
621
602
  # -->
622
603
  # Tests the file is empty.
@@ -626,102 +607,78 @@ class Pathname
626
607
  def empty?: () -> bool
627
608
 
628
609
  # <!--
629
- # rdoc-file=ext/pathname/pathname.c
610
+ # rdoc-file=pathname_builtin.rb
630
611
  # - entries()
631
612
  # -->
632
613
  # Return the entries (files and subdirectories) in the directory, each as a
633
614
  # Pathname object.
634
615
  #
635
- # The results contains just the names in the directory, without any trailing
636
- # slashes or recursive look-up.
637
- #
638
- # pp Pathname.new('/usr/local').entries
639
- # #=> [#<Pathname:share>,
640
- # # #<Pathname:lib>,
641
- # # #<Pathname:..>,
642
- # # #<Pathname:include>,
643
- # # #<Pathname:etc>,
644
- # # #<Pathname:bin>,
645
- # # #<Pathname:man>,
646
- # # #<Pathname:games>,
647
- # # #<Pathname:.>,
648
- # # #<Pathname:sbin>,
649
- # # #<Pathname:src>]
650
- #
651
- # The result may contain the current directory `#<Pathname:.>` and the parent
652
- # directory `#<Pathname:..>`.
653
- #
654
- # If you don't want `.` and `..` and want directories, consider
655
- # Pathname#children.
656
- #
657
616
  def entries: () -> Array[Pathname]
658
617
 
659
- # <!-- rdoc-file=ext/pathname/pathname.c -->
660
- # Compare this pathname with `other`. The comparison is string-based. Be aware
661
- # that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
662
- # file.
618
+ # <!--
619
+ # rdoc-file=pathname_builtin.rb
620
+ # - eql?(other)
621
+ # -->
663
622
  #
664
623
  def eql?: (untyped) -> bool
665
624
 
666
625
  # <!--
667
- # rdoc-file=ext/pathname/pathname.c
626
+ # rdoc-file=pathname_builtin.rb
668
627
  # - executable?()
669
628
  # -->
670
- # See FileTest.executable?.
629
+ # See `FileTest.executable?`.
671
630
  #
672
631
  def executable?: () -> bool
673
632
 
674
633
  # <!--
675
- # rdoc-file=ext/pathname/pathname.c
634
+ # rdoc-file=pathname_builtin.rb
676
635
  # - executable_real?()
677
636
  # -->
678
- # See FileTest.executable_real?.
637
+ # See `FileTest.executable_real?`.
679
638
  #
680
639
  def executable_real?: () -> bool
681
640
 
682
641
  # <!--
683
- # rdoc-file=ext/pathname/pathname.c
642
+ # rdoc-file=pathname_builtin.rb
684
643
  # - exist?()
685
644
  # -->
686
- # See FileTest.exist?.
645
+ # See `FileTest.exist?`.
687
646
  #
688
647
  def exist?: () -> bool
689
648
 
690
649
  # <!--
691
- # rdoc-file=ext/pathname/pathname.c
692
- # - expand_path(p1 = v1)
650
+ # rdoc-file=pathname_builtin.rb
651
+ # - expand_path(...)
693
652
  # -->
694
- # Returns the absolute path for the file.
695
- #
696
- # See File.expand_path.
653
+ # See `File.expand_path`.
697
654
  #
698
655
  def expand_path: (?String dir) -> Pathname
699
656
 
700
657
  # <!--
701
- # rdoc-file=ext/pathname/pathname.c
658
+ # rdoc-file=pathname_builtin.rb
702
659
  # - extname()
703
660
  # -->
704
- # Returns the file's extension.
705
- #
706
- # See File.extname.
661
+ # See `File.extname`. Returns the file's extension.
707
662
  #
708
663
  def extname: () -> String
709
664
 
710
665
  # <!--
711
- # rdoc-file=ext/pathname/pathname.c
666
+ # rdoc-file=pathname_builtin.rb
712
667
  # - file?()
713
668
  # -->
714
- # See FileTest.file?.
669
+ # See `FileTest.file?`.
715
670
  #
716
671
  def file?: () -> bool
717
672
 
718
673
  # <!--
719
- # rdoc-file=ext/pathname/lib/pathname.rb
674
+ # rdoc-file=lib/pathname.rb
720
675
  # - find(ignore_error: true) { |pathname| ... }
721
676
  # -->
722
677
  # Iterates over the directory tree in a depth first manner, yielding a Pathname
723
678
  # for each file under "this" directory.
724
679
  #
680
+ # Note that you need to require 'pathname' to use this method.
681
+ #
725
682
  # Returns an Enumerator if no block is given.
726
683
  #
727
684
  # Since it is implemented by the standard library module Find, Find.prune can be
@@ -736,46 +693,39 @@ class Pathname
736
693
  | (?ignore_error: boolish) -> Enumerator[Pathname, nil]
737
694
 
738
695
  # <!--
739
- # rdoc-file=ext/pathname/pathname.c
740
- # - pathname.fnmatch(pattern, [flags]) -> true or false
741
- # - pathname.fnmatch?(pattern, [flags]) -> true or false
696
+ # rdoc-file=pathname_builtin.rb
697
+ # - fnmatch(pattern, ...)
742
698
  # -->
743
- # Return `true` if the receiver matches the given pattern.
744
- #
745
- # See File.fnmatch.
699
+ # See `File.fnmatch`. Return `true` if the receiver matches the given pattern.
746
700
  #
747
701
  def fnmatch: (String pattern, ?Integer flags) -> bool
748
702
 
749
- # <!-- rdoc-file=ext/pathname/pathname.c -->
750
- # Return `true` if the receiver matches the given pattern.
751
- #
752
- # See File.fnmatch.
703
+ # <!--
704
+ # rdoc-file=pathname_builtin.rb
705
+ # - fnmatch?(pattern, ...)
706
+ # -->
707
+ # See `File.fnmatch?` (same as #fnmatch).
753
708
  #
754
709
  alias fnmatch? fnmatch
755
710
 
756
711
  # <!--
757
- # rdoc-file=ext/pathname/pathname.c
758
- # - pathname.freeze -> obj
712
+ # rdoc-file=pathname_builtin.rb
713
+ # - freeze()
759
714
  # -->
760
- # Freezes this Pathname.
761
- #
762
- # See Object.freeze.
763
715
  #
764
716
  def freeze: () -> Pathname
765
717
 
766
718
  # <!--
767
- # rdoc-file=ext/pathname/pathname.c
768
- # - pathname.ftype -> string
719
+ # rdoc-file=pathname_builtin.rb
720
+ # - ftype()
769
721
  # -->
770
- # Returns "type" of file ("file", "directory", etc).
771
- #
772
- # See File.ftype.
722
+ # See `File.ftype`. Returns "type" of file ("file", "directory", etc).
773
723
  #
774
724
  def ftype: () -> String
775
725
 
776
726
  # <!--
777
- # rdoc-file=ext/pathname/pathname.c
778
- # - glob(p1, p2 = v2)
727
+ # rdoc-file=pathname_builtin.rb
728
+ # - glob(*args, **kwargs) { |pathname| ... }
779
729
  # -->
780
730
  # Returns or yields Pathname objects.
781
731
  #
@@ -788,10 +738,10 @@ class Pathname
788
738
  | (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
789
739
 
790
740
  # <!--
791
- # rdoc-file=ext/pathname/pathname.c
741
+ # rdoc-file=pathname_builtin.rb
792
742
  # - grpowned?()
793
743
  # -->
794
- # See FileTest.grpowned?.
744
+ # See `FileTest.grpowned?`.
795
745
  #
796
746
  def grpowned?: () -> bool
797
747
 
@@ -800,7 +750,7 @@ class Pathname
800
750
  def inspect: () -> String
801
751
 
802
752
  # <!--
803
- # rdoc-file=ext/pathname/lib/pathname.rb
753
+ # rdoc-file=pathname_builtin.rb
804
754
  # - join(*args)
805
755
  # -->
806
756
  # Joins the given pathnames onto `self` to create a new Pathname object. This is
@@ -817,36 +767,32 @@ class Pathname
817
767
  def join: (*String | _ToStr | Pathname args) -> Pathname
818
768
 
819
769
  # <!--
820
- # rdoc-file=ext/pathname/pathname.c
821
- # - pathname.lchmod(mode_int) -> integer
770
+ # rdoc-file=pathname_builtin.rb
771
+ # - lchmod(mode)
822
772
  # -->
823
- # Same as Pathname.chmod, but does not follow symbolic links.
824
- #
825
- # See File.lchmod.
773
+ # See `File.lchmod`.
826
774
  #
827
775
  def lchmod: (Integer mode) -> Integer
828
776
 
829
777
  # <!--
830
- # rdoc-file=ext/pathname/pathname.c
831
- # - pathname.lchown(owner_int, group_int) -> integer
778
+ # rdoc-file=pathname_builtin.rb
779
+ # - lchown(owner, group)
832
780
  # -->
833
- # Same as Pathname.chown, but does not follow symbolic links.
834
- #
835
- # See File.lchown.
781
+ # See `File.lchown`.
836
782
  #
837
783
  def lchown: (Integer owner, Integer group) -> Integer
838
784
 
839
785
  # <!--
840
- # rdoc-file=ext/pathname/pathname.c
786
+ # rdoc-file=pathname_builtin.rb
841
787
  # - lstat()
842
788
  # -->
843
- # See File.lstat.
789
+ # See `File.lstat`.
844
790
  #
845
791
  def lstat: () -> ::File::Stat
846
792
 
847
793
  # <!--
848
- # rdoc-file=ext/pathname/pathname.c
849
- # - lutime(p1, p2)
794
+ # rdoc-file=pathname_builtin.rb
795
+ # - lutime(atime, mtime)
850
796
  # -->
851
797
  # Update the access and modification times of the file.
852
798
  #
@@ -857,37 +803,31 @@ class Pathname
857
803
  def lutime: (Time | Numeric atime, Time | Numeric mtime) -> Integer
858
804
 
859
805
  # <!--
860
- # rdoc-file=ext/pathname/pathname.c
861
- # - pathname.make_link(old)
806
+ # rdoc-file=pathname_builtin.rb
807
+ # - make_link(old)
862
808
  # -->
863
- # Creates a hard link at *pathname*.
864
- #
865
- # See File.link.
809
+ # See `File.link`. Creates a hard link.
866
810
  #
867
811
  def make_link: (String | Pathname | _ToStr old) -> Integer
868
812
 
869
813
  # <!--
870
- # rdoc-file=ext/pathname/pathname.c
871
- # - pathname.make_symlink(old)
814
+ # rdoc-file=pathname_builtin.rb
815
+ # - make_symlink(old)
872
816
  # -->
873
- # Creates a symbolic link.
874
- #
875
- # See File.symlink.
817
+ # See `File.symlink`. Creates a symbolic link.
876
818
  #
877
819
  def make_symlink: (String | Pathname | _ToStr old) -> Integer
878
820
 
879
821
  # <!--
880
- # rdoc-file=ext/pathname/pathname.c
881
- # - mkdir(p1 = v1)
822
+ # rdoc-file=pathname_builtin.rb
823
+ # - mkdir(...)
882
824
  # -->
883
- # Create the referenced directory.
884
- #
885
- # See Dir.mkdir.
825
+ # See `Dir.mkdir`. Create the referenced directory.
886
826
  #
887
827
  def mkdir: (?Integer perm) -> Integer
888
828
 
889
829
  # <!--
890
- # rdoc-file=ext/pathname/lib/pathname.rb
830
+ # rdoc-file=pathname_builtin.rb
891
831
  # - mkpath(mode: nil)
892
832
  # -->
893
833
  # Creates a full path, including any intermediate directories that don't yet
@@ -898,7 +838,7 @@ class Pathname
898
838
  def mkpath: () -> self
899
839
 
900
840
  # <!--
901
- # rdoc-file=ext/pathname/lib/pathname.rb
841
+ # rdoc-file=pathname_builtin.rb
902
842
  # - mountpoint?()
903
843
  # -->
904
844
  # Returns `true` if `self` points to a mountpoint.
@@ -906,51 +846,41 @@ class Pathname
906
846
  def mountpoint?: () -> bool
907
847
 
908
848
  # <!--
909
- # rdoc-file=ext/pathname/pathname.c
910
- # - pathname.mtime -> time
849
+ # rdoc-file=pathname_builtin.rb
850
+ # - mtime()
911
851
  # -->
912
- # Returns the last modified time of the file.
913
- #
914
- # See File.mtime.
852
+ # See `File.mtime`. Returns last modification time.
915
853
  #
916
854
  def mtime: () -> Time
917
855
 
918
856
  # <!--
919
- # rdoc-file=ext/pathname/pathname.c
920
- # - pathname.open()
921
- # - pathname.open(mode="r" [, opt]) -> file
922
- # - pathname.open([mode [, perm]] [, opt]) -> file
923
- # - pathname.open(mode="r" [, opt]) {|file| block } -> obj
924
- # - pathname.open([mode [, perm]] [, opt]) {|file| block } -> obj
857
+ # rdoc-file=pathname_builtin.rb
858
+ # - open(...) { |file| ... }
925
859
  # -->
926
- # Opens the file for reading or writing.
927
- #
928
- # See File.open.
860
+ # See `File.open`. Opens the file for reading or writing.
929
861
  #
930
862
  def open: (?string | int mode, ?int perm) -> File
931
863
  | [T] (?string | int mode, ?int perm) { (File) -> T } -> T
932
864
 
933
865
  # <!--
934
- # rdoc-file=ext/pathname/pathname.c
935
- # - opendir()
866
+ # rdoc-file=pathname_builtin.rb
867
+ # - opendir() { |dir| ... }
936
868
  # -->
937
- # Opens the referenced directory.
938
- #
939
- # See Dir.open.
869
+ # See `Dir.open`.
940
870
  #
941
871
  def opendir: () -> Dir
942
872
  | [U] () { (Dir) -> U } -> U
943
873
 
944
874
  # <!--
945
- # rdoc-file=ext/pathname/pathname.c
875
+ # rdoc-file=pathname_builtin.rb
946
876
  # - owned?()
947
877
  # -->
948
- # See FileTest.owned?.
878
+ # See `FileTest.owned?`.
949
879
  #
950
880
  def owned?: () -> bool
951
881
 
952
882
  # <!--
953
- # rdoc-file=ext/pathname/lib/pathname.rb
883
+ # rdoc-file=pathname_builtin.rb
954
884
  # - parent()
955
885
  # -->
956
886
  # Returns the parent directory.
@@ -960,66 +890,58 @@ class Pathname
960
890
  def parent: () -> Pathname
961
891
 
962
892
  # <!--
963
- # rdoc-file=ext/pathname/pathname.c
893
+ # rdoc-file=pathname_builtin.rb
964
894
  # - pipe?()
965
895
  # -->
966
- # See FileTest.pipe?.
896
+ # See `FileTest.pipe?`.
967
897
  #
968
898
  def pipe?: () -> bool
969
899
 
970
900
  # <!--
971
- # rdoc-file=ext/pathname/pathname.c
972
- # - pathname.read([length [, offset]]) -> string
973
- # - pathname.read([length [, offset]], open_args) -> string
901
+ # rdoc-file=pathname_builtin.rb
902
+ # - read(...)
974
903
  # -->
975
- # Returns all data from the file, or the first `N` bytes if specified.
976
- #
977
- # See File.read.
904
+ # See `File.read`. Returns all data from the file, or the first `N` bytes if
905
+ # specified.
978
906
  #
979
907
  def read: (?Integer length, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> String
980
908
 
981
909
  # <!--
982
- # rdoc-file=ext/pathname/pathname.c
910
+ # rdoc-file=pathname_builtin.rb
983
911
  # - readable?()
984
912
  # -->
985
- # See FileTest.readable?.
913
+ # See `FileTest.readable?`.
986
914
  #
987
915
  def readable?: () -> bool
988
916
 
989
917
  # <!--
990
- # rdoc-file=ext/pathname/pathname.c
918
+ # rdoc-file=pathname_builtin.rb
991
919
  # - readable_real?()
992
920
  # -->
993
- # See FileTest.readable_real?.
921
+ # See `FileTest.readable_real?`.
994
922
  #
995
923
  def readable_real?: () -> bool
996
924
 
997
925
  # <!--
998
- # rdoc-file=ext/pathname/pathname.c
999
- # - pathname.readlines(sep=$/ [, open_args]) -> array
1000
- # - pathname.readlines(limit [, open_args]) -> array
1001
- # - pathname.readlines(sep, limit [, open_args]) -> array
926
+ # rdoc-file=pathname_builtin.rb
927
+ # - readlines(...)
1002
928
  # -->
1003
- # Returns all the lines from the file.
1004
- #
1005
- # See File.readlines.
929
+ # See `File.readlines`. Returns all the lines from the file.
1006
930
  #
1007
931
  def readlines: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
1008
932
  | (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
1009
933
 
1010
934
  # <!--
1011
- # rdoc-file=ext/pathname/pathname.c
935
+ # rdoc-file=pathname_builtin.rb
1012
936
  # - readlink()
1013
937
  # -->
1014
- # Read symbolic link.
1015
- #
1016
- # See File.readlink.
938
+ # See `File.readlink`. Read symbolic link.
1017
939
  #
1018
940
  def readlink: () -> untyped
1019
941
 
1020
942
  # <!--
1021
- # rdoc-file=ext/pathname/pathname.c
1022
- # - realdirpath(p1 = v1)
943
+ # rdoc-file=pathname_builtin.rb
944
+ # - realdirpath(...)
1023
945
  # -->
1024
946
  # Returns the real (absolute) pathname of `self` in the actual filesystem.
1025
947
  #
@@ -1030,8 +952,8 @@ class Pathname
1030
952
  def realdirpath: (?string | Pathname base_dir) -> Pathname
1031
953
 
1032
954
  # <!--
1033
- # rdoc-file=ext/pathname/pathname.c
1034
- # - realpath(p1 = v1)
955
+ # rdoc-file=pathname_builtin.rb
956
+ # - realpath(...)
1035
957
  # -->
1036
958
  # Returns the real (absolute) pathname for `self` in the actual filesystem.
1037
959
  #
@@ -1042,7 +964,7 @@ class Pathname
1042
964
  def realpath: (?string | Pathname base_dir) -> Pathname
1043
965
 
1044
966
  # <!--
1045
- # rdoc-file=ext/pathname/lib/pathname.rb
967
+ # rdoc-file=pathname_builtin.rb
1046
968
  # - relative?()
1047
969
  # -->
1048
970
  # The opposite of Pathname#absolute?
@@ -1060,7 +982,7 @@ class Pathname
1060
982
  def relative?: () -> bool
1061
983
 
1062
984
  # <!--
1063
- # rdoc-file=ext/pathname/lib/pathname.rb
985
+ # rdoc-file=pathname_builtin.rb
1064
986
  # - relative_path_from(base_directory)
1065
987
  # -->
1066
988
  # Returns a relative path from the given `base_directory` to the receiver.
@@ -1079,37 +1001,35 @@ class Pathname
1079
1001
  def relative_path_from: (Pathname | string base_directory) -> Pathname
1080
1002
 
1081
1003
  # <!--
1082
- # rdoc-file=ext/pathname/pathname.c
1083
- # - rename(p1)
1004
+ # rdoc-file=pathname_builtin.rb
1005
+ # - rename(to)
1084
1006
  # -->
1085
- # Rename the file.
1086
- #
1087
- # See File.rename.
1007
+ # See `File.rename`. Rename the file.
1088
1008
  #
1089
1009
  def rename: (Pathname | string new_name) -> 0
1090
1010
 
1091
1011
  # <!--
1092
- # rdoc-file=ext/pathname/pathname.c
1012
+ # rdoc-file=pathname_builtin.rb
1093
1013
  # - rmdir()
1094
1014
  # -->
1095
- # Remove the referenced directory.
1096
- #
1097
- # See Dir.rmdir.
1015
+ # See `Dir.rmdir`. Remove the referenced directory.
1098
1016
  #
1099
1017
  def rmdir: () -> 0
1100
1018
 
1101
1019
  # <!--
1102
- # rdoc-file=ext/pathname/lib/pathname.rb
1020
+ # rdoc-file=lib/pathname.rb
1103
1021
  # - rmtree(noop: nil, verbose: nil, secure: nil)
1104
1022
  # -->
1105
1023
  # Recursively deletes a directory, including all directories beneath it.
1106
1024
  #
1025
+ # Note that you need to require 'pathname' to use this method.
1026
+ #
1107
1027
  # See FileUtils.rm_rf
1108
1028
  #
1109
1029
  def rmtree: () -> self
1110
1030
 
1111
1031
  # <!--
1112
- # rdoc-file=ext/pathname/lib/pathname.rb
1032
+ # rdoc-file=pathname_builtin.rb
1113
1033
  # - root?()
1114
1034
  # -->
1115
1035
  # Predicate method for root directories. Returns `true` if the pathname
@@ -1121,75 +1041,71 @@ class Pathname
1121
1041
  def root?: () -> bool
1122
1042
 
1123
1043
  # <!--
1124
- # rdoc-file=ext/pathname/pathname.c
1044
+ # rdoc-file=pathname_builtin.rb
1125
1045
  # - setgid?()
1126
1046
  # -->
1127
- # See FileTest.setgid?.
1047
+ # See `FileTest.setgid?`.
1128
1048
  #
1129
1049
  def setgid?: () -> bool
1130
1050
 
1131
1051
  # <!--
1132
- # rdoc-file=ext/pathname/pathname.c
1052
+ # rdoc-file=pathname_builtin.rb
1133
1053
  # - setuid?()
1134
1054
  # -->
1135
- # See FileTest.setuid?.
1055
+ # See `FileTest.setuid?`.
1136
1056
  #
1137
1057
  def setuid?: () -> bool
1138
1058
 
1139
1059
  # <!--
1140
- # rdoc-file=ext/pathname/pathname.c
1060
+ # rdoc-file=pathname_builtin.rb
1141
1061
  # - size()
1142
1062
  # -->
1143
- # See FileTest.size.
1063
+ # See `FileTest.size`.
1144
1064
  #
1145
1065
  def size: () -> Integer
1146
1066
 
1147
1067
  # <!--
1148
- # rdoc-file=ext/pathname/pathname.c
1068
+ # rdoc-file=pathname_builtin.rb
1149
1069
  # - size?()
1150
1070
  # -->
1151
- # See FileTest.size?.
1071
+ # See `FileTest.size?`.
1152
1072
  #
1153
1073
  def size?: () -> Integer?
1154
1074
 
1155
1075
  # <!--
1156
- # rdoc-file=ext/pathname/pathname.c
1076
+ # rdoc-file=pathname_builtin.rb
1157
1077
  # - socket?()
1158
1078
  # -->
1159
- # See FileTest.socket?.
1079
+ # See `FileTest.socket?`.
1160
1080
  #
1161
1081
  def socket?: () -> untyped
1162
1082
 
1163
1083
  # <!--
1164
- # rdoc-file=ext/pathname/pathname.c
1084
+ # rdoc-file=pathname_builtin.rb
1165
1085
  # - split()
1166
1086
  # -->
1167
- # Returns the #dirname and the #basename in an Array.
1168
- #
1169
- # See File.split.
1087
+ # See `File.split`. Returns the #dirname and the #basename in an Array.
1170
1088
  #
1171
1089
  def split: () -> [ Pathname, Pathname ]
1172
1090
 
1173
1091
  # <!--
1174
- # rdoc-file=ext/pathname/pathname.c
1092
+ # rdoc-file=pathname_builtin.rb
1175
1093
  # - stat()
1176
1094
  # -->
1177
- # Returns a File::Stat object.
1178
- #
1179
- # See File.stat.
1095
+ # See `File.stat`. Returns a `File::Stat` object.
1180
1096
  #
1181
1097
  def stat: () -> File::Stat
1182
1098
 
1183
1099
  # <!--
1184
- # rdoc-file=ext/pathname/pathname.c
1100
+ # rdoc-file=pathname_builtin.rb
1185
1101
  # - sticky?()
1186
1102
  # -->
1187
- # See FileTest.sticky?.
1103
+ # See `FileTest.sticky?`.
1188
1104
  #
1189
1105
  def sticky?: () -> untyped
1190
1106
 
1191
1107
  # <!--
1192
- # rdoc-file=ext/pathname/pathname.c
1108
+ # rdoc-file=pathname.c
1193
1109
  # - sub(*args)
1194
1110
  # -->
1195
1111
  # Return a pathname which is substituted by String#sub.
@@ -1202,8 +1118,8 @@ class Pathname
1202
1118
  | (Regexp | string pattern) { (String match) -> string } -> Pathname
1203
1119
 
1204
1120
  # <!--
1205
- # rdoc-file=ext/pathname/pathname.c
1206
- # - sub_ext(p1)
1121
+ # rdoc-file=pathname_builtin.rb
1122
+ # - sub_ext(repl)
1207
1123
  # -->
1208
1124
  # Return a pathname with `repl` added as a suffix to the basename.
1209
1125
  #
@@ -1215,18 +1131,18 @@ class Pathname
1215
1131
  def sub_ext: (string replacement) -> Pathname
1216
1132
 
1217
1133
  # <!--
1218
- # rdoc-file=ext/pathname/pathname.c
1134
+ # rdoc-file=pathname_builtin.rb
1219
1135
  # - symlink?()
1220
1136
  # -->
1221
- # See FileTest.symlink?.
1137
+ # See `FileTest.symlink?`.
1222
1138
  #
1223
1139
  def symlink?: () -> untyped
1224
1140
 
1225
1141
  # <!--
1226
- # rdoc-file=ext/pathname/pathname.c
1227
- # - pathname.sysopen([mode, [perm]]) -> fixnum
1142
+ # rdoc-file=pathname_builtin.rb
1143
+ # - sysopen(...)
1228
1144
  # -->
1229
- # See IO.sysopen.
1145
+ # See `File.sysopen`.
1230
1146
  #
1231
1147
  def sysopen: (?String mode, ?Integer perm) -> Integer
1232
1148
 
@@ -1246,32 +1162,26 @@ class Pathname
1246
1162
  def to_path: () -> String
1247
1163
 
1248
1164
  # <!--
1249
- # rdoc-file=ext/pathname/pathname.c
1250
- # - pathname.to_s -> string
1251
- # - pathname.to_path -> string
1165
+ # rdoc-file=pathname_builtin.rb
1166
+ # - to_s()
1252
1167
  # -->
1253
1168
  # Return the path as a String.
1254
1169
  #
1255
- # to_path is implemented so Pathname objects are usable with File.open, etc.
1256
- #
1257
1170
  alias to_s to_path
1258
1171
 
1259
1172
  # <!--
1260
- # rdoc-file=ext/pathname/pathname.c
1261
- # - truncate(p1)
1173
+ # rdoc-file=pathname_builtin.rb
1174
+ # - truncate(length)
1262
1175
  # -->
1263
- # Truncates the file to `length` bytes.
1264
- #
1265
- # See File.truncate.
1176
+ # See `File.truncate`. Truncate the file to `length` bytes.
1266
1177
  #
1267
1178
  def truncate: (Integer length) -> 0
1268
1179
 
1269
1180
  # <!--
1270
- # rdoc-file=ext/pathname/pathname.c
1181
+ # rdoc-file=pathname_builtin.rb
1271
1182
  # - unlink()
1272
1183
  # -->
1273
- # Removes a file or directory, using File.unlink if `self` is a file, or
1274
- # Dir.unlink as necessary.
1184
+ # Removes a file or directory, using `File.unlink` or `Dir.unlink` as necessary.
1275
1185
  #
1276
1186
  def unlink: () -> Integer
1277
1187
 
@@ -1284,63 +1194,58 @@ class Pathname
1284
1194
  def untaint: () -> Pathname
1285
1195
 
1286
1196
  # <!--
1287
- # rdoc-file=ext/pathname/pathname.c
1288
- # - utime(p1, p2)
1197
+ # rdoc-file=pathname_builtin.rb
1198
+ # - utime(atime, mtime)
1289
1199
  # -->
1290
- # Update the access and modification times of the file.
1291
- #
1292
- # See File.utime.
1200
+ # See `File.utime`. Update the access and modification times.
1293
1201
  #
1294
1202
  def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
1295
1203
 
1296
1204
  # <!--
1297
- # rdoc-file=ext/pathname/pathname.c
1205
+ # rdoc-file=pathname_builtin.rb
1298
1206
  # - world_readable?()
1299
1207
  # -->
1300
- # See FileTest.world_readable?.
1208
+ # See `FileTest.world_readable?`.
1301
1209
  #
1302
1210
  def world_readable?: () -> (Integer | nil)
1303
1211
 
1304
1212
  # <!--
1305
- # rdoc-file=ext/pathname/pathname.c
1213
+ # rdoc-file=pathname_builtin.rb
1306
1214
  # - world_writable?()
1307
1215
  # -->
1308
- # See FileTest.world_writable?.
1216
+ # See `FileTest.world_writable?`.
1309
1217
  #
1310
1218
  def world_writable?: () -> (Integer | nil)
1311
1219
 
1312
1220
  # <!--
1313
- # rdoc-file=ext/pathname/pathname.c
1221
+ # rdoc-file=pathname_builtin.rb
1314
1222
  # - writable?()
1315
1223
  # -->
1316
- # See FileTest.writable?.
1224
+ # See `FileTest.writable?`.
1317
1225
  #
1318
1226
  def writable?: () -> bool
1319
1227
 
1320
1228
  # <!--
1321
- # rdoc-file=ext/pathname/pathname.c
1229
+ # rdoc-file=pathname_builtin.rb
1322
1230
  # - writable_real?()
1323
1231
  # -->
1324
- # See FileTest.writable_real?.
1232
+ # See `FileTest.writable_real?`.
1325
1233
  #
1326
1234
  def writable_real?: () -> bool
1327
1235
 
1328
1236
  # <!--
1329
- # rdoc-file=ext/pathname/pathname.c
1330
- # - pathname.write(string, [offset] ) => fixnum
1331
- # - pathname.write(string, [offset], open_args ) => fixnum
1237
+ # rdoc-file=pathname_builtin.rb
1238
+ # - write(...)
1332
1239
  # -->
1333
- # Writes `contents` to the file.
1334
- #
1335
- # See File.write.
1240
+ # Writes `contents` to the file. See `File.write`.
1336
1241
  #
1337
1242
  def write: (String content, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> Integer
1338
1243
 
1339
1244
  # <!--
1340
- # rdoc-file=ext/pathname/pathname.c
1245
+ # rdoc-file=pathname_builtin.rb
1341
1246
  # - zero?()
1342
1247
  # -->
1343
- # See FileTest.zero?.
1248
+ # See `FileTest.zero?`.
1344
1249
  #
1345
1250
  def zero?: () -> bool
1346
1251
 
@@ -1359,11 +1264,11 @@ class Pathname
1359
1264
  def has_trailing_separator?: (untyped path) -> untyped
1360
1265
 
1361
1266
  # <!--
1362
- # rdoc-file=ext/pathname/pathname.c
1363
- # - new(p1)
1267
+ # rdoc-file=pathname_builtin.rb
1268
+ # - new(path)
1364
1269
  # -->
1365
1270
  # Create a Pathname object from the given String (or String-like object). If
1366
- # `path` contains a NULL character (`\0`), an ArgumentError is raised.
1271
+ # `path` contains a NUL character (`\0`), an ArgumentError is raised.
1367
1272
  #
1368
1273
  def initialize: (string | Pathname) -> void
1369
1274
 
@@ -1375,8 +1280,14 @@ class Pathname
1375
1280
 
1376
1281
  SAME_PATHS: Proc
1377
1282
 
1283
+ # <!-- rdoc-file=pathname_builtin.rb -->
1284
+ # Separator list string.
1285
+ #
1378
1286
  SEPARATOR_LIST: String
1379
1287
 
1288
+ # <!-- rdoc-file=pathname_builtin.rb -->
1289
+ # Regexp that matches a separator.
1290
+ #
1380
1291
  SEPARATOR_PAT: Regexp
1381
1292
 
1382
1293
  TO_PATH: Symbol
@@ -1387,20 +1298,10 @@ module Kernel
1387
1298
  private
1388
1299
 
1389
1300
  # <!--
1390
- # rdoc-file=ext/pathname/pathname.c
1391
- # - Pathname(path) -> pathname
1301
+ # rdoc-file=pathname_builtin.rb
1302
+ # - Pathname(path)
1392
1303
  # -->
1393
- # Creates a new Pathname object from the given string, `path`, and returns
1394
- # pathname object.
1395
- #
1396
- # In order to use this constructor, you must first require the Pathname standard
1397
- # library extension.
1398
- #
1399
- # require 'pathname'
1400
- # Pathname("/home/zzak")
1401
- # #=> #<Pathname:/home/zzak>
1402
- #
1403
- # See also Pathname::new for more information.
1304
+ # Creates a Pathname object.
1404
1305
  #
1405
1306
  def self?.Pathname: (string | Pathname) -> Pathname
1406
1307
  end