rbs 3.9.5 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) 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/CHANGELOG.md +49 -0
  11. data/README.md +38 -1
  12. data/Rakefile +152 -23
  13. data/config.yml +190 -62
  14. data/core/array.rbs +100 -46
  15. data/core/complex.rbs +32 -21
  16. data/core/dir.rbs +2 -2
  17. data/core/encoding.rbs +6 -9
  18. data/core/enumerable.rbs +90 -3
  19. data/core/enumerator.rbs +18 -1
  20. data/core/errno.rbs +8 -0
  21. data/core/errors.rbs +28 -1
  22. data/core/exception.rbs +2 -2
  23. data/core/fiber.rbs +5 -4
  24. data/core/file.rbs +27 -12
  25. data/core/file_test.rbs +1 -1
  26. data/core/float.rbs +209 -22
  27. data/core/gc.rbs +417 -281
  28. data/core/hash.rbs +1024 -727
  29. data/core/integer.rbs +78 -38
  30. data/core/io/buffer.rbs +18 -7
  31. data/core/io/wait.rbs +11 -33
  32. data/core/io.rbs +14 -12
  33. data/core/kernel.rbs +57 -51
  34. data/core/marshal.rbs +1 -1
  35. data/core/match_data.rbs +1 -1
  36. data/core/math.rbs +42 -3
  37. data/core/method.rbs +14 -6
  38. data/core/module.rbs +88 -17
  39. data/core/nil_class.rbs +3 -3
  40. data/core/numeric.rbs +16 -16
  41. data/core/object.rbs +3 -3
  42. data/core/object_space.rbs +21 -15
  43. data/{stdlib/pathname/0 → core}/pathname.rbs +255 -355
  44. data/core/proc.rbs +15 -8
  45. data/core/process.rbs +2 -2
  46. data/core/ractor.rbs +278 -437
  47. data/core/range.rbs +7 -8
  48. data/core/rational.rbs +37 -24
  49. data/core/rbs/unnamed/argf.rbs +2 -2
  50. data/core/rbs/unnamed/env_class.rbs +1 -1
  51. data/core/rbs/unnamed/random.rbs +4 -2
  52. data/core/regexp.rbs +25 -20
  53. data/core/ruby.rbs +53 -0
  54. data/core/ruby_vm.rbs +6 -4
  55. data/core/rubygems/errors.rbs +3 -70
  56. data/core/rubygems/rubygems.rbs +11 -79
  57. data/core/rubygems/version.rbs +2 -3
  58. data/core/set.rbs +488 -359
  59. data/core/string.rbs +3145 -1231
  60. data/core/struct.rbs +1 -1
  61. data/core/symbol.rbs +4 -4
  62. data/core/thread.rbs +92 -29
  63. data/core/time.rbs +35 -9
  64. data/core/trace_point.rbs +7 -4
  65. data/core/unbound_method.rbs +14 -6
  66. data/docs/aliases.md +79 -0
  67. data/docs/collection.md +2 -2
  68. data/docs/encoding.md +56 -0
  69. data/docs/gem.md +0 -1
  70. data/docs/sigs.md +3 -3
  71. data/ext/rbs_extension/ast_translation.c +1016 -0
  72. data/ext/rbs_extension/ast_translation.h +37 -0
  73. data/ext/rbs_extension/class_constants.c +155 -0
  74. data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
  75. data/ext/rbs_extension/compat.h +10 -0
  76. data/ext/rbs_extension/extconf.rb +25 -1
  77. data/ext/rbs_extension/legacy_location.c +317 -0
  78. data/ext/rbs_extension/legacy_location.h +45 -0
  79. data/ext/rbs_extension/main.c +357 -14
  80. data/ext/rbs_extension/rbs_extension.h +6 -21
  81. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  82. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  83. data/include/rbs/ast.h +687 -0
  84. data/include/rbs/defines.h +86 -0
  85. data/include/rbs/lexer.h +199 -0
  86. data/include/rbs/location.h +59 -0
  87. data/include/rbs/parser.h +135 -0
  88. data/include/rbs/string.h +47 -0
  89. data/include/rbs/util/rbs_allocator.h +59 -0
  90. data/include/rbs/util/rbs_assert.h +20 -0
  91. data/include/rbs/util/rbs_buffer.h +83 -0
  92. data/include/rbs/util/rbs_constant_pool.h +6 -67
  93. data/include/rbs/util/rbs_encoding.h +282 -0
  94. data/include/rbs/util/rbs_unescape.h +24 -0
  95. data/include/rbs.h +1 -2
  96. data/lib/rbs/annotate/formatter.rb +3 -13
  97. data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
  98. data/lib/rbs/annotate/rdoc_source.rb +1 -1
  99. data/lib/rbs/cli/validate.rb +2 -2
  100. data/lib/rbs/cli.rb +1 -1
  101. data/lib/rbs/collection/config/lockfile_generator.rb +1 -0
  102. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
  103. data/lib/rbs/environment.rb +64 -59
  104. data/lib/rbs/environment_loader.rb +1 -1
  105. data/lib/rbs/errors.rb +1 -1
  106. data/lib/rbs/parser_aux.rb +5 -0
  107. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  108. data/lib/rbs/resolver/type_name_resolver.rb +124 -38
  109. data/lib/rbs/test/type_check.rb +14 -0
  110. data/lib/rbs/types.rb +3 -1
  111. data/lib/rbs/version.rb +1 -1
  112. data/lib/rbs.rb +1 -1
  113. data/lib/rdoc/discover.rb +1 -1
  114. data/lib/rdoc_plugin/parser.rb +3 -3
  115. data/sig/annotate/formatter.rbs +2 -2
  116. data/sig/annotate/rdoc_annotater.rbs +1 -1
  117. data/sig/environment.rbs +57 -6
  118. data/sig/manifest.yaml +0 -1
  119. data/sig/parser.rbs +20 -0
  120. data/sig/resolver/type_name_resolver.rbs +38 -7
  121. data/sig/types.rbs +4 -1
  122. data/src/ast.c +1256 -0
  123. data/src/lexer.c +2956 -0
  124. data/src/lexer.re +147 -0
  125. data/src/lexstate.c +205 -0
  126. data/src/location.c +71 -0
  127. data/src/parser.c +3507 -0
  128. data/src/string.c +41 -0
  129. data/src/util/rbs_allocator.c +152 -0
  130. data/src/util/rbs_assert.c +19 -0
  131. data/src/util/rbs_buffer.c +54 -0
  132. data/src/util/rbs_constant_pool.c +18 -88
  133. data/src/util/rbs_encoding.c +21308 -0
  134. data/src/util/rbs_unescape.c +167 -0
  135. data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
  136. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  137. data/stdlib/cgi/0/core.rbs +2 -396
  138. data/stdlib/cgi/0/manifest.yaml +1 -0
  139. data/stdlib/cgi-escape/0/escape.rbs +153 -0
  140. data/stdlib/coverage/0/coverage.rbs +3 -1
  141. data/stdlib/date/0/date.rbs +67 -59
  142. data/stdlib/date/0/date_time.rbs +1 -1
  143. data/stdlib/delegate/0/delegator.rbs +10 -7
  144. data/stdlib/erb/0/erb.rbs +737 -347
  145. data/stdlib/fileutils/0/fileutils.rbs +18 -13
  146. data/stdlib/forwardable/0/forwardable.rbs +3 -0
  147. data/stdlib/json/0/json.rbs +68 -48
  148. data/stdlib/net-http/0/net-http.rbs +3 -0
  149. data/stdlib/objspace/0/objspace.rbs +9 -4
  150. data/stdlib/open-uri/0/open-uri.rbs +40 -0
  151. data/stdlib/openssl/0/openssl.rbs +331 -228
  152. data/stdlib/optparse/0/optparse.rbs +3 -3
  153. data/stdlib/psych/0/psych.rbs +3 -3
  154. data/stdlib/rdoc/0/code_object.rbs +2 -2
  155. data/stdlib/rdoc/0/comment.rbs +2 -0
  156. data/stdlib/rdoc/0/options.rbs +76 -0
  157. data/stdlib/rdoc/0/rdoc.rbs +7 -5
  158. data/stdlib/rdoc/0/store.rbs +1 -1
  159. data/stdlib/resolv/0/resolv.rbs +25 -68
  160. data/stdlib/ripper/0/ripper.rbs +5 -2
  161. data/stdlib/singleton/0/singleton.rbs +3 -0
  162. data/stdlib/socket/0/socket.rbs +13 -1
  163. data/stdlib/socket/0/tcp_socket.rbs +10 -2
  164. data/stdlib/stringio/0/stringio.rbs +1176 -85
  165. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  166. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  167. data/stdlib/time/0/time.rbs +1 -1
  168. data/stdlib/timeout/0/timeout.rbs +63 -7
  169. data/stdlib/tsort/0/cyclic.rbs +3 -0
  170. data/stdlib/uri/0/common.rbs +11 -2
  171. data/stdlib/uri/0/file.rbs +1 -1
  172. data/stdlib/uri/0/generic.rbs +17 -16
  173. data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
  174. data/stdlib/zlib/0/zstream.rbs +1 -0
  175. metadata +43 -18
  176. data/ext/rbs_extension/lexer.c +0 -2728
  177. data/ext/rbs_extension/lexer.h +0 -179
  178. data/ext/rbs_extension/lexer.re +0 -147
  179. data/ext/rbs_extension/lexstate.c +0 -175
  180. data/ext/rbs_extension/location.c +0 -325
  181. data/ext/rbs_extension/location.h +0 -85
  182. data/ext/rbs_extension/parser.c +0 -2982
  183. data/ext/rbs_extension/parser.h +0 -18
  184. data/ext/rbs_extension/parserstate.c +0 -411
  185. data/ext/rbs_extension/parserstate.h +0 -163
  186. data/ext/rbs_extension/unescape.c +0 -32
  187. data/include/rbs/ruby_objs.h +0 -72
  188. data/src/constants.c +0 -153
  189. 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,40 @@ 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.
715
+ # Freze self.
763
716
  #
764
717
  def freeze: () -> Pathname
765
718
 
766
719
  # <!--
767
- # rdoc-file=ext/pathname/pathname.c
768
- # - pathname.ftype -> string
720
+ # rdoc-file=pathname_builtin.rb
721
+ # - ftype()
769
722
  # -->
770
- # Returns "type" of file ("file", "directory", etc).
771
- #
772
- # See File.ftype.
723
+ # See `File.ftype`. Returns "type" of file ("file", "directory", etc).
773
724
  #
774
725
  def ftype: () -> String
775
726
 
776
727
  # <!--
777
- # rdoc-file=ext/pathname/pathname.c
778
- # - glob(p1, p2 = v2)
728
+ # rdoc-file=pathname_builtin.rb
729
+ # - glob(*args, **kwargs) { |pathname| ... }
779
730
  # -->
780
731
  # Returns or yields Pathname objects.
781
732
  #
@@ -788,10 +739,10 @@ class Pathname
788
739
  | (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
789
740
 
790
741
  # <!--
791
- # rdoc-file=ext/pathname/pathname.c
742
+ # rdoc-file=pathname_builtin.rb
792
743
  # - grpowned?()
793
744
  # -->
794
- # See FileTest.grpowned?.
745
+ # See `FileTest.grpowned?`.
795
746
  #
796
747
  def grpowned?: () -> bool
797
748
 
@@ -800,7 +751,7 @@ class Pathname
800
751
  def inspect: () -> String
801
752
 
802
753
  # <!--
803
- # rdoc-file=ext/pathname/lib/pathname.rb
754
+ # rdoc-file=pathname_builtin.rb
804
755
  # - join(*args)
805
756
  # -->
806
757
  # Joins the given pathnames onto `self` to create a new Pathname object. This is
@@ -817,36 +768,32 @@ class Pathname
817
768
  def join: (*String | _ToStr | Pathname args) -> Pathname
818
769
 
819
770
  # <!--
820
- # rdoc-file=ext/pathname/pathname.c
821
- # - pathname.lchmod(mode_int) -> integer
771
+ # rdoc-file=pathname_builtin.rb
772
+ # - lchmod(mode)
822
773
  # -->
823
- # Same as Pathname.chmod, but does not follow symbolic links.
824
- #
825
- # See File.lchmod.
774
+ # See `File.lchmod`.
826
775
  #
827
776
  def lchmod: (Integer mode) -> Integer
828
777
 
829
778
  # <!--
830
- # rdoc-file=ext/pathname/pathname.c
831
- # - pathname.lchown(owner_int, group_int) -> integer
779
+ # rdoc-file=pathname_builtin.rb
780
+ # - lchown(owner, group)
832
781
  # -->
833
- # Same as Pathname.chown, but does not follow symbolic links.
834
- #
835
- # See File.lchown.
782
+ # See `File.lchown`.
836
783
  #
837
784
  def lchown: (Integer owner, Integer group) -> Integer
838
785
 
839
786
  # <!--
840
- # rdoc-file=ext/pathname/pathname.c
787
+ # rdoc-file=pathname_builtin.rb
841
788
  # - lstat()
842
789
  # -->
843
- # See File.lstat.
790
+ # See `File.lstat`.
844
791
  #
845
792
  def lstat: () -> ::File::Stat
846
793
 
847
794
  # <!--
848
- # rdoc-file=ext/pathname/pathname.c
849
- # - lutime(p1, p2)
795
+ # rdoc-file=pathname_builtin.rb
796
+ # - lutime(atime, mtime)
850
797
  # -->
851
798
  # Update the access and modification times of the file.
852
799
  #
@@ -857,37 +804,31 @@ class Pathname
857
804
  def lutime: (Time | Numeric atime, Time | Numeric mtime) -> Integer
858
805
 
859
806
  # <!--
860
- # rdoc-file=ext/pathname/pathname.c
861
- # - pathname.make_link(old)
807
+ # rdoc-file=pathname_builtin.rb
808
+ # - make_link(old)
862
809
  # -->
863
- # Creates a hard link at *pathname*.
864
- #
865
- # See File.link.
810
+ # See `File.link`. Creates a hard link.
866
811
  #
867
812
  def make_link: (String | Pathname | _ToStr old) -> Integer
868
813
 
869
814
  # <!--
870
- # rdoc-file=ext/pathname/pathname.c
871
- # - pathname.make_symlink(old)
815
+ # rdoc-file=pathname_builtin.rb
816
+ # - make_symlink(old)
872
817
  # -->
873
- # Creates a symbolic link.
874
- #
875
- # See File.symlink.
818
+ # See `File.symlink`. Creates a symbolic link.
876
819
  #
877
820
  def make_symlink: (String | Pathname | _ToStr old) -> Integer
878
821
 
879
822
  # <!--
880
- # rdoc-file=ext/pathname/pathname.c
881
- # - mkdir(p1 = v1)
823
+ # rdoc-file=pathname_builtin.rb
824
+ # - mkdir(...)
882
825
  # -->
883
- # Create the referenced directory.
884
- #
885
- # See Dir.mkdir.
826
+ # See `Dir.mkdir`. Create the referenced directory.
886
827
  #
887
828
  def mkdir: (?Integer perm) -> Integer
888
829
 
889
830
  # <!--
890
- # rdoc-file=ext/pathname/lib/pathname.rb
831
+ # rdoc-file=pathname_builtin.rb
891
832
  # - mkpath(mode: nil)
892
833
  # -->
893
834
  # Creates a full path, including any intermediate directories that don't yet
@@ -898,7 +839,7 @@ class Pathname
898
839
  def mkpath: () -> self
899
840
 
900
841
  # <!--
901
- # rdoc-file=ext/pathname/lib/pathname.rb
842
+ # rdoc-file=pathname_builtin.rb
902
843
  # - mountpoint?()
903
844
  # -->
904
845
  # Returns `true` if `self` points to a mountpoint.
@@ -906,51 +847,41 @@ class Pathname
906
847
  def mountpoint?: () -> bool
907
848
 
908
849
  # <!--
909
- # rdoc-file=ext/pathname/pathname.c
910
- # - pathname.mtime -> time
850
+ # rdoc-file=pathname_builtin.rb
851
+ # - mtime()
911
852
  # -->
912
- # Returns the last modified time of the file.
913
- #
914
- # See File.mtime.
853
+ # See `File.mtime`. Returns last modification time.
915
854
  #
916
855
  def mtime: () -> Time
917
856
 
918
857
  # <!--
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
858
+ # rdoc-file=pathname_builtin.rb
859
+ # - open(...) { |file| ... }
925
860
  # -->
926
- # Opens the file for reading or writing.
927
- #
928
- # See File.open.
861
+ # See `File.open`. Opens the file for reading or writing.
929
862
  #
930
863
  def open: (?string | int mode, ?int perm) -> File
931
864
  | [T] (?string | int mode, ?int perm) { (File) -> T } -> T
932
865
 
933
866
  # <!--
934
- # rdoc-file=ext/pathname/pathname.c
935
- # - opendir()
867
+ # rdoc-file=pathname_builtin.rb
868
+ # - opendir() { |dir| ... }
936
869
  # -->
937
- # Opens the referenced directory.
938
- #
939
- # See Dir.open.
870
+ # See `Dir.open`.
940
871
  #
941
872
  def opendir: () -> Dir
942
873
  | [U] () { (Dir) -> U } -> U
943
874
 
944
875
  # <!--
945
- # rdoc-file=ext/pathname/pathname.c
876
+ # rdoc-file=pathname_builtin.rb
946
877
  # - owned?()
947
878
  # -->
948
- # See FileTest.owned?.
879
+ # See `FileTest.owned?`.
949
880
  #
950
881
  def owned?: () -> bool
951
882
 
952
883
  # <!--
953
- # rdoc-file=ext/pathname/lib/pathname.rb
884
+ # rdoc-file=pathname_builtin.rb
954
885
  # - parent()
955
886
  # -->
956
887
  # Returns the parent directory.
@@ -960,66 +891,58 @@ class Pathname
960
891
  def parent: () -> Pathname
961
892
 
962
893
  # <!--
963
- # rdoc-file=ext/pathname/pathname.c
894
+ # rdoc-file=pathname_builtin.rb
964
895
  # - pipe?()
965
896
  # -->
966
- # See FileTest.pipe?.
897
+ # See `FileTest.pipe?`.
967
898
  #
968
899
  def pipe?: () -> bool
969
900
 
970
901
  # <!--
971
- # rdoc-file=ext/pathname/pathname.c
972
- # - pathname.read([length [, offset]]) -> string
973
- # - pathname.read([length [, offset]], open_args) -> string
902
+ # rdoc-file=pathname_builtin.rb
903
+ # - read(...)
974
904
  # -->
975
- # Returns all data from the file, or the first `N` bytes if specified.
976
- #
977
- # See File.read.
905
+ # See `File.read`. Returns all data from the file, or the first `N` bytes if
906
+ # specified.
978
907
  #
979
908
  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
909
 
981
910
  # <!--
982
- # rdoc-file=ext/pathname/pathname.c
911
+ # rdoc-file=pathname_builtin.rb
983
912
  # - readable?()
984
913
  # -->
985
- # See FileTest.readable?.
914
+ # See `FileTest.readable?`.
986
915
  #
987
916
  def readable?: () -> bool
988
917
 
989
918
  # <!--
990
- # rdoc-file=ext/pathname/pathname.c
919
+ # rdoc-file=pathname_builtin.rb
991
920
  # - readable_real?()
992
921
  # -->
993
- # See FileTest.readable_real?.
922
+ # See `FileTest.readable_real?`.
994
923
  #
995
924
  def readable_real?: () -> bool
996
925
 
997
926
  # <!--
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
927
+ # rdoc-file=pathname_builtin.rb
928
+ # - readlines(...)
1002
929
  # -->
1003
- # Returns all the lines from the file.
1004
- #
1005
- # See File.readlines.
930
+ # See `File.readlines`. Returns all the lines from the file.
1006
931
  #
1007
932
  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
933
  | (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
934
 
1010
935
  # <!--
1011
- # rdoc-file=ext/pathname/pathname.c
936
+ # rdoc-file=pathname_builtin.rb
1012
937
  # - readlink()
1013
938
  # -->
1014
- # Read symbolic link.
1015
- #
1016
- # See File.readlink.
939
+ # See `File.readlink`. Read symbolic link.
1017
940
  #
1018
941
  def readlink: () -> untyped
1019
942
 
1020
943
  # <!--
1021
- # rdoc-file=ext/pathname/pathname.c
1022
- # - realdirpath(p1 = v1)
944
+ # rdoc-file=pathname_builtin.rb
945
+ # - realdirpath(...)
1023
946
  # -->
1024
947
  # Returns the real (absolute) pathname of `self` in the actual filesystem.
1025
948
  #
@@ -1030,8 +953,8 @@ class Pathname
1030
953
  def realdirpath: (?string | Pathname base_dir) -> Pathname
1031
954
 
1032
955
  # <!--
1033
- # rdoc-file=ext/pathname/pathname.c
1034
- # - realpath(p1 = v1)
956
+ # rdoc-file=pathname_builtin.rb
957
+ # - realpath(...)
1035
958
  # -->
1036
959
  # Returns the real (absolute) pathname for `self` in the actual filesystem.
1037
960
  #
@@ -1042,7 +965,7 @@ class Pathname
1042
965
  def realpath: (?string | Pathname base_dir) -> Pathname
1043
966
 
1044
967
  # <!--
1045
- # rdoc-file=ext/pathname/lib/pathname.rb
968
+ # rdoc-file=pathname_builtin.rb
1046
969
  # - relative?()
1047
970
  # -->
1048
971
  # The opposite of Pathname#absolute?
@@ -1060,7 +983,7 @@ class Pathname
1060
983
  def relative?: () -> bool
1061
984
 
1062
985
  # <!--
1063
- # rdoc-file=ext/pathname/lib/pathname.rb
986
+ # rdoc-file=pathname_builtin.rb
1064
987
  # - relative_path_from(base_directory)
1065
988
  # -->
1066
989
  # Returns a relative path from the given `base_directory` to the receiver.
@@ -1079,37 +1002,35 @@ class Pathname
1079
1002
  def relative_path_from: (Pathname | string base_directory) -> Pathname
1080
1003
 
1081
1004
  # <!--
1082
- # rdoc-file=ext/pathname/pathname.c
1083
- # - rename(p1)
1005
+ # rdoc-file=pathname_builtin.rb
1006
+ # - rename(to)
1084
1007
  # -->
1085
- # Rename the file.
1086
- #
1087
- # See File.rename.
1008
+ # See `File.rename`. Rename the file.
1088
1009
  #
1089
1010
  def rename: (Pathname | string new_name) -> 0
1090
1011
 
1091
1012
  # <!--
1092
- # rdoc-file=ext/pathname/pathname.c
1013
+ # rdoc-file=pathname_builtin.rb
1093
1014
  # - rmdir()
1094
1015
  # -->
1095
- # Remove the referenced directory.
1096
- #
1097
- # See Dir.rmdir.
1016
+ # See `Dir.rmdir`. Remove the referenced directory.
1098
1017
  #
1099
1018
  def rmdir: () -> 0
1100
1019
 
1101
1020
  # <!--
1102
- # rdoc-file=ext/pathname/lib/pathname.rb
1021
+ # rdoc-file=lib/pathname.rb
1103
1022
  # - rmtree(noop: nil, verbose: nil, secure: nil)
1104
1023
  # -->
1105
1024
  # Recursively deletes a directory, including all directories beneath it.
1106
1025
  #
1026
+ # Note that you need to require 'pathname' to use this method.
1027
+ #
1107
1028
  # See FileUtils.rm_rf
1108
1029
  #
1109
1030
  def rmtree: () -> self
1110
1031
 
1111
1032
  # <!--
1112
- # rdoc-file=ext/pathname/lib/pathname.rb
1033
+ # rdoc-file=pathname_builtin.rb
1113
1034
  # - root?()
1114
1035
  # -->
1115
1036
  # Predicate method for root directories. Returns `true` if the pathname
@@ -1121,75 +1042,71 @@ class Pathname
1121
1042
  def root?: () -> bool
1122
1043
 
1123
1044
  # <!--
1124
- # rdoc-file=ext/pathname/pathname.c
1045
+ # rdoc-file=pathname_builtin.rb
1125
1046
  # - setgid?()
1126
1047
  # -->
1127
- # See FileTest.setgid?.
1048
+ # See `FileTest.setgid?`.
1128
1049
  #
1129
1050
  def setgid?: () -> bool
1130
1051
 
1131
1052
  # <!--
1132
- # rdoc-file=ext/pathname/pathname.c
1053
+ # rdoc-file=pathname_builtin.rb
1133
1054
  # - setuid?()
1134
1055
  # -->
1135
- # See FileTest.setuid?.
1056
+ # See `FileTest.setuid?`.
1136
1057
  #
1137
1058
  def setuid?: () -> bool
1138
1059
 
1139
1060
  # <!--
1140
- # rdoc-file=ext/pathname/pathname.c
1061
+ # rdoc-file=pathname_builtin.rb
1141
1062
  # - size()
1142
1063
  # -->
1143
- # See FileTest.size.
1064
+ # See `FileTest.size`.
1144
1065
  #
1145
1066
  def size: () -> Integer
1146
1067
 
1147
1068
  # <!--
1148
- # rdoc-file=ext/pathname/pathname.c
1069
+ # rdoc-file=pathname_builtin.rb
1149
1070
  # - size?()
1150
1071
  # -->
1151
- # See FileTest.size?.
1072
+ # See `FileTest.size?`.
1152
1073
  #
1153
1074
  def size?: () -> Integer?
1154
1075
 
1155
1076
  # <!--
1156
- # rdoc-file=ext/pathname/pathname.c
1077
+ # rdoc-file=pathname_builtin.rb
1157
1078
  # - socket?()
1158
1079
  # -->
1159
- # See FileTest.socket?.
1080
+ # See `FileTest.socket?`.
1160
1081
  #
1161
1082
  def socket?: () -> untyped
1162
1083
 
1163
1084
  # <!--
1164
- # rdoc-file=ext/pathname/pathname.c
1085
+ # rdoc-file=pathname_builtin.rb
1165
1086
  # - split()
1166
1087
  # -->
1167
- # Returns the #dirname and the #basename in an Array.
1168
- #
1169
- # See File.split.
1088
+ # See `File.split`. Returns the #dirname and the #basename in an Array.
1170
1089
  #
1171
1090
  def split: () -> [ Pathname, Pathname ]
1172
1091
 
1173
1092
  # <!--
1174
- # rdoc-file=ext/pathname/pathname.c
1093
+ # rdoc-file=pathname_builtin.rb
1175
1094
  # - stat()
1176
1095
  # -->
1177
- # Returns a File::Stat object.
1178
- #
1179
- # See File.stat.
1096
+ # See `File.stat`. Returns a `File::Stat` object.
1180
1097
  #
1181
1098
  def stat: () -> File::Stat
1182
1099
 
1183
1100
  # <!--
1184
- # rdoc-file=ext/pathname/pathname.c
1101
+ # rdoc-file=pathname_builtin.rb
1185
1102
  # - sticky?()
1186
1103
  # -->
1187
- # See FileTest.sticky?.
1104
+ # See `FileTest.sticky?`.
1188
1105
  #
1189
1106
  def sticky?: () -> untyped
1190
1107
 
1191
1108
  # <!--
1192
- # rdoc-file=ext/pathname/pathname.c
1109
+ # rdoc-file=pathname.c
1193
1110
  # - sub(*args)
1194
1111
  # -->
1195
1112
  # Return a pathname which is substituted by String#sub.
@@ -1202,8 +1119,8 @@ class Pathname
1202
1119
  | (Regexp | string pattern) { (String match) -> string } -> Pathname
1203
1120
 
1204
1121
  # <!--
1205
- # rdoc-file=ext/pathname/pathname.c
1206
- # - sub_ext(p1)
1122
+ # rdoc-file=pathname_builtin.rb
1123
+ # - sub_ext(repl)
1207
1124
  # -->
1208
1125
  # Return a pathname with `repl` added as a suffix to the basename.
1209
1126
  #
@@ -1215,18 +1132,18 @@ class Pathname
1215
1132
  def sub_ext: (string replacement) -> Pathname
1216
1133
 
1217
1134
  # <!--
1218
- # rdoc-file=ext/pathname/pathname.c
1135
+ # rdoc-file=pathname_builtin.rb
1219
1136
  # - symlink?()
1220
1137
  # -->
1221
- # See FileTest.symlink?.
1138
+ # See `FileTest.symlink?`.
1222
1139
  #
1223
1140
  def symlink?: () -> untyped
1224
1141
 
1225
1142
  # <!--
1226
- # rdoc-file=ext/pathname/pathname.c
1227
- # - pathname.sysopen([mode, [perm]]) -> fixnum
1143
+ # rdoc-file=pathname_builtin.rb
1144
+ # - sysopen(...)
1228
1145
  # -->
1229
- # See IO.sysopen.
1146
+ # See `File.sysopen`.
1230
1147
  #
1231
1148
  def sysopen: (?String mode, ?Integer perm) -> Integer
1232
1149
 
@@ -1238,40 +1155,32 @@ class Pathname
1238
1155
  #
1239
1156
  def taint: () -> Pathname
1240
1157
 
1241
- # <!-- rdoc-file=ext/pathname/pathname.c -->
1242
- # Return the path as a String.
1243
- #
1158
+ # <!-- rdoc-file=pathname_builtin.rb -->
1244
1159
  # to_path is implemented so Pathname objects are usable with File.open, etc.
1245
1160
  #
1246
1161
  def to_path: () -> String
1247
1162
 
1248
1163
  # <!--
1249
- # rdoc-file=ext/pathname/pathname.c
1250
- # - pathname.to_s -> string
1251
- # - pathname.to_path -> string
1164
+ # rdoc-file=pathname_builtin.rb
1165
+ # - to_s()
1252
1166
  # -->
1253
1167
  # Return the path as a String.
1254
1168
  #
1255
- # to_path is implemented so Pathname objects are usable with File.open, etc.
1256
- #
1257
1169
  alias to_s to_path
1258
1170
 
1259
1171
  # <!--
1260
- # rdoc-file=ext/pathname/pathname.c
1261
- # - truncate(p1)
1172
+ # rdoc-file=pathname_builtin.rb
1173
+ # - truncate(length)
1262
1174
  # -->
1263
- # Truncates the file to `length` bytes.
1264
- #
1265
- # See File.truncate.
1175
+ # See `File.truncate`. Truncate the file to `length` bytes.
1266
1176
  #
1267
1177
  def truncate: (Integer length) -> 0
1268
1178
 
1269
1179
  # <!--
1270
- # rdoc-file=ext/pathname/pathname.c
1180
+ # rdoc-file=pathname_builtin.rb
1271
1181
  # - unlink()
1272
1182
  # -->
1273
- # Removes a file or directory, using File.unlink if `self` is a file, or
1274
- # Dir.unlink as necessary.
1183
+ # Removes a file or directory, using `File.unlink` or `Dir.unlink` as necessary.
1275
1184
  #
1276
1185
  def unlink: () -> Integer
1277
1186
 
@@ -1284,63 +1193,58 @@ class Pathname
1284
1193
  def untaint: () -> Pathname
1285
1194
 
1286
1195
  # <!--
1287
- # rdoc-file=ext/pathname/pathname.c
1288
- # - utime(p1, p2)
1196
+ # rdoc-file=pathname_builtin.rb
1197
+ # - utime(atime, mtime)
1289
1198
  # -->
1290
- # Update the access and modification times of the file.
1291
- #
1292
- # See File.utime.
1199
+ # See `File.utime`. Update the access and modification times.
1293
1200
  #
1294
1201
  def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
1295
1202
 
1296
1203
  # <!--
1297
- # rdoc-file=ext/pathname/pathname.c
1204
+ # rdoc-file=pathname_builtin.rb
1298
1205
  # - world_readable?()
1299
1206
  # -->
1300
- # See FileTest.world_readable?.
1207
+ # See `FileTest.world_readable?`.
1301
1208
  #
1302
1209
  def world_readable?: () -> (Integer | nil)
1303
1210
 
1304
1211
  # <!--
1305
- # rdoc-file=ext/pathname/pathname.c
1212
+ # rdoc-file=pathname_builtin.rb
1306
1213
  # - world_writable?()
1307
1214
  # -->
1308
- # See FileTest.world_writable?.
1215
+ # See `FileTest.world_writable?`.
1309
1216
  #
1310
1217
  def world_writable?: () -> (Integer | nil)
1311
1218
 
1312
1219
  # <!--
1313
- # rdoc-file=ext/pathname/pathname.c
1220
+ # rdoc-file=pathname_builtin.rb
1314
1221
  # - writable?()
1315
1222
  # -->
1316
- # See FileTest.writable?.
1223
+ # See `FileTest.writable?`.
1317
1224
  #
1318
1225
  def writable?: () -> bool
1319
1226
 
1320
1227
  # <!--
1321
- # rdoc-file=ext/pathname/pathname.c
1228
+ # rdoc-file=pathname_builtin.rb
1322
1229
  # - writable_real?()
1323
1230
  # -->
1324
- # See FileTest.writable_real?.
1231
+ # See `FileTest.writable_real?`.
1325
1232
  #
1326
1233
  def writable_real?: () -> bool
1327
1234
 
1328
1235
  # <!--
1329
- # rdoc-file=ext/pathname/pathname.c
1330
- # - pathname.write(string, [offset] ) => fixnum
1331
- # - pathname.write(string, [offset], open_args ) => fixnum
1236
+ # rdoc-file=pathname_builtin.rb
1237
+ # - write(...)
1332
1238
  # -->
1333
- # Writes `contents` to the file.
1334
- #
1335
- # See File.write.
1239
+ # Writes `contents` to the file. See `File.write`.
1336
1240
  #
1337
1241
  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
1242
 
1339
1243
  # <!--
1340
- # rdoc-file=ext/pathname/pathname.c
1244
+ # rdoc-file=pathname_builtin.rb
1341
1245
  # - zero?()
1342
1246
  # -->
1343
- # See FileTest.zero?.
1247
+ # See `FileTest.zero?`.
1344
1248
  #
1345
1249
  def zero?: () -> bool
1346
1250
 
@@ -1359,11 +1263,11 @@ class Pathname
1359
1263
  def has_trailing_separator?: (untyped path) -> untyped
1360
1264
 
1361
1265
  # <!--
1362
- # rdoc-file=ext/pathname/pathname.c
1363
- # - new(p1)
1266
+ # rdoc-file=pathname_builtin.rb
1267
+ # - new(path)
1364
1268
  # -->
1365
1269
  # Create a Pathname object from the given String (or String-like object). If
1366
- # `path` contains a NULL character (`\0`), an ArgumentError is raised.
1270
+ # `path` contains a NUL character (`\0`), an ArgumentError is raised.
1367
1271
  #
1368
1272
  def initialize: (string | Pathname) -> void
1369
1273
 
@@ -1375,8 +1279,14 @@ class Pathname
1375
1279
 
1376
1280
  SAME_PATHS: Proc
1377
1281
 
1282
+ # <!-- rdoc-file=pathname_builtin.rb -->
1283
+ # Separator list string.
1284
+ #
1378
1285
  SEPARATOR_LIST: String
1379
1286
 
1287
+ # <!-- rdoc-file=pathname_builtin.rb -->
1288
+ # Regexp that matches a separator.
1289
+ #
1380
1290
  SEPARATOR_PAT: Regexp
1381
1291
 
1382
1292
  TO_PATH: Symbol
@@ -1387,20 +1297,10 @@ module Kernel
1387
1297
  private
1388
1298
 
1389
1299
  # <!--
1390
- # rdoc-file=ext/pathname/pathname.c
1391
- # - Pathname(path) -> pathname
1300
+ # rdoc-file=pathname_builtin.rb
1301
+ # - Pathname(path)
1392
1302
  # -->
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.
1303
+ # Creates a Pathname object.
1404
1304
  #
1405
1305
  def self?.Pathname: (string | Pathname) -> Pathname
1406
1306
  end