rbs 3.10.0 → 4.0.0.dev.1

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