rbs 2.0.0 → 2.2.2
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.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +34 -0
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +82 -0
- data/README.md +6 -1
- data/Rakefile +56 -21
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +1214 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1060 -142
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2319 -318
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/docs/syntax.md +54 -11
- data/ext/rbs_extension/extconf.rb +1 -0
- data/ext/rbs_extension/lexer.h +5 -0
- data/ext/rbs_extension/lexstate.c +6 -0
- data/ext/rbs_extension/parser.c +85 -10
- data/ext/rbs_extension/ruby_objs.c +4 -2
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/goodcheck.yml +0 -11
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/ast/members.rb +21 -13
- data/lib/rbs/buffer.rb +17 -11
- data/lib/rbs/cli.rb +48 -1
- data/lib/rbs/definition_builder/method_builder.rb +28 -16
- data/lib/rbs/definition_builder.rb +6 -2
- data/lib/rbs/environment.rb +8 -4
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/type_alias_regularity.rb +6 -4
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +1 -1
- data/lib/rbs/validator.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +54 -4
- data/lib/rbs.rb +0 -2
- data/schema/typeParam.json +3 -3
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/buffer.rbs +6 -2
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/members.rbs +24 -18
- data/sig/method_builder.rbs +5 -4
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/sig/validator.rbs +3 -1
- data/sig/writer.rbs +79 -2
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +649 -21
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1147 -145
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/manifest.yaml +1 -0
- data/stdlib/net-http/0/net-http.rbs +1513 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +423 -109
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +558 -329
- data/stdlib/uri/0/http.rbs +60 -114
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +18 -6
- data/lib/rbs/location.rb +0 -221
- data/sig/char_scanner.rbs +0 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
|
1
2
|
# Pathname represents the name of a file or directory on the filesystem, but not
|
|
2
3
|
# the file itself.
|
|
3
4
|
#
|
|
@@ -161,6 +162,8 @@
|
|
|
161
162
|
# * #binread(*args)
|
|
162
163
|
# * #readlines(*args)
|
|
163
164
|
# * #sysopen(*args)
|
|
165
|
+
# * #write(*args)
|
|
166
|
+
# * #binwrite(*args)
|
|
164
167
|
#
|
|
165
168
|
#
|
|
166
169
|
# ### Utilities
|
|
@@ -181,6 +184,10 @@
|
|
|
181
184
|
# information. In some cases, a brief description will follow.
|
|
182
185
|
#
|
|
183
186
|
class Pathname
|
|
187
|
+
# <!--
|
|
188
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
189
|
+
# - getwd()
|
|
190
|
+
# -->
|
|
184
191
|
# Returns the current working directory as a Pathname.
|
|
185
192
|
#
|
|
186
193
|
# Pathname.getwd
|
|
@@ -190,6 +197,10 @@ class Pathname
|
|
|
190
197
|
#
|
|
191
198
|
def self.getwd: () -> Pathname
|
|
192
199
|
|
|
200
|
+
# <!--
|
|
201
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
202
|
+
# - glob(p1, p2 = v2, p3 = v3)
|
|
203
|
+
# -->
|
|
193
204
|
# Returns or yields Pathname objects.
|
|
194
205
|
#
|
|
195
206
|
# Pathname.glob("lib/i*.rb")
|
|
@@ -200,6 +211,10 @@ class Pathname
|
|
|
200
211
|
def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
|
201
212
|
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
|
202
213
|
|
|
214
|
+
# <!--
|
|
215
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
216
|
+
# - pwd()
|
|
217
|
+
# -->
|
|
203
218
|
# Returns the current working directory as a Pathname.
|
|
204
219
|
#
|
|
205
220
|
# Pathname.getwd
|
|
@@ -211,6 +226,10 @@ class Pathname
|
|
|
211
226
|
|
|
212
227
|
public
|
|
213
228
|
|
|
229
|
+
# <!--
|
|
230
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
231
|
+
# - +(other)
|
|
232
|
+
# -->
|
|
214
233
|
# Appends a pathname fragment to `self` to produce a new Pathname object.
|
|
215
234
|
#
|
|
216
235
|
# p1 = Pathname.new("/usr") # Pathname:/usr
|
|
@@ -225,8 +244,17 @@ class Pathname
|
|
|
225
244
|
#
|
|
226
245
|
def +: (Pathname | String | _ToStr other) -> Pathname
|
|
227
246
|
|
|
247
|
+
# <!--
|
|
248
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
249
|
+
# - /(other)
|
|
250
|
+
# -->
|
|
251
|
+
#
|
|
228
252
|
alias / +
|
|
229
253
|
|
|
254
|
+
# <!--
|
|
255
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
256
|
+
# - <=>(p1)
|
|
257
|
+
# -->
|
|
230
258
|
# Provides a case-sensitive comparison operator for pathnames.
|
|
231
259
|
#
|
|
232
260
|
# Pathname.new('/usr') <=> Pathname.new('/usr/bin')
|
|
@@ -243,18 +271,27 @@ class Pathname
|
|
|
243
271
|
def <=>: (Pathname other) -> Integer
|
|
244
272
|
| (untyped other) -> nil
|
|
245
273
|
|
|
274
|
+
# <!--
|
|
275
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
276
|
+
# - ==(p1)
|
|
277
|
+
# -->
|
|
246
278
|
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
|
247
279
|
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
|
248
280
|
# file.
|
|
249
281
|
#
|
|
250
282
|
def ==: (untyped) -> bool
|
|
251
283
|
|
|
284
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
|
252
285
|
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
|
253
286
|
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
|
254
287
|
# file.
|
|
255
288
|
#
|
|
256
289
|
def ===: (untyped) -> bool
|
|
257
290
|
|
|
291
|
+
# <!--
|
|
292
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
293
|
+
# - absolute?()
|
|
294
|
+
# -->
|
|
258
295
|
# Predicate method for testing whether a path is absolute.
|
|
259
296
|
#
|
|
260
297
|
# It returns `true` if the pathname begins with a slash.
|
|
@@ -269,6 +306,10 @@ class Pathname
|
|
|
269
306
|
#
|
|
270
307
|
def absolute?: () -> bool
|
|
271
308
|
|
|
309
|
+
# <!--
|
|
310
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
311
|
+
# - ascend() { |self| ... }
|
|
312
|
+
# -->
|
|
272
313
|
# Iterates over and yields a new Pathname object for each element in the given
|
|
273
314
|
# path in ascending order.
|
|
274
315
|
#
|
|
@@ -297,49 +338,51 @@ class Pathname
|
|
|
297
338
|
def ascend: () { (Pathname) -> untyped } -> nil
|
|
298
339
|
| () -> Enumerator[Pathname, nil]
|
|
299
340
|
|
|
341
|
+
# <!--
|
|
342
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
343
|
+
# - pathname.atime -> time
|
|
344
|
+
# -->
|
|
300
345
|
# Returns the last access time for the file.
|
|
301
346
|
#
|
|
302
347
|
# See File.atime.
|
|
303
348
|
#
|
|
304
349
|
def atime: () -> Time
|
|
305
350
|
|
|
351
|
+
# <!--
|
|
352
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
353
|
+
# - basename(p1 = v1)
|
|
354
|
+
# -->
|
|
306
355
|
# Returns the last component of the path.
|
|
307
356
|
#
|
|
308
357
|
# See File.basename.
|
|
309
358
|
#
|
|
310
359
|
def basename: (?String | _ToStr suffix) -> Pathname
|
|
311
360
|
|
|
361
|
+
# <!--
|
|
362
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
363
|
+
# - pathname.binread([length [, offset]]) -> string
|
|
364
|
+
# -->
|
|
312
365
|
# Returns all the bytes from the file, or the first `N` if specified.
|
|
313
366
|
#
|
|
314
367
|
# See File.binread.
|
|
315
368
|
#
|
|
316
369
|
def binread: (?Integer length, ?Integer offset) -> String
|
|
317
370
|
|
|
371
|
+
# <!--
|
|
372
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
373
|
+
# - pathname.binwrite(string, [offset] ) => fixnum
|
|
374
|
+
# - pathname.binwrite(string, [offset], open_args ) => fixnum
|
|
375
|
+
# -->
|
|
318
376
|
# Writes `contents` to the file, opening it in binary mode.
|
|
319
377
|
#
|
|
320
378
|
# See File.binwrite.
|
|
321
379
|
#
|
|
322
|
-
def binwrite: (String, ?Integer offset,
|
|
323
|
-
?mode: Integer | String,
|
|
324
|
-
?flags: Integer,
|
|
325
|
-
?external_encoding: encoding,
|
|
326
|
-
?internal_encoding: encoding,
|
|
327
|
-
?encoding: encoding,
|
|
328
|
-
?textmode: boolish,
|
|
329
|
-
?binmode: boolish,
|
|
330
|
-
?autoclose: boolish,
|
|
331
|
-
|
|
332
|
-
# From String#encode
|
|
333
|
-
?invalid: :replace ?,
|
|
334
|
-
?undef: :replace ?,
|
|
335
|
-
?replace: String,
|
|
336
|
-
?fallback: Hash[String, String] | Proc | Method,
|
|
337
|
-
?xml: :text | :attr,
|
|
338
|
-
?universal_newline: true,
|
|
339
|
-
?cr_newline: true,
|
|
340
|
-
?crlf_newline: true,
|
|
341
|
-
) -> Integer
|
|
380
|
+
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
|
|
342
381
|
|
|
382
|
+
# <!--
|
|
383
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
384
|
+
# - pathname.birthtime -> time
|
|
385
|
+
# -->
|
|
343
386
|
# Returns the birth time for the file. If the platform doesn't have birthtime,
|
|
344
387
|
# raises NotImplementedError.
|
|
345
388
|
#
|
|
@@ -347,14 +390,26 @@ class Pathname
|
|
|
347
390
|
#
|
|
348
391
|
def birthtime: () -> Time
|
|
349
392
|
|
|
393
|
+
# <!--
|
|
394
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
395
|
+
# - blockdev?()
|
|
396
|
+
# -->
|
|
350
397
|
# See FileTest.blockdev?.
|
|
351
398
|
#
|
|
352
399
|
def blockdev?: () -> bool
|
|
353
400
|
|
|
401
|
+
# <!--
|
|
402
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
403
|
+
# - chardev?()
|
|
404
|
+
# -->
|
|
354
405
|
# See FileTest.chardev?.
|
|
355
406
|
#
|
|
356
407
|
def chardev?: () -> bool
|
|
357
408
|
|
|
409
|
+
# <!--
|
|
410
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
411
|
+
# - children(with_directory=true)
|
|
412
|
+
# -->
|
|
358
413
|
# Returns the children of the directory (files and subdirectories, not
|
|
359
414
|
# recursive) as an array of Pathname objects.
|
|
360
415
|
#
|
|
@@ -376,18 +431,30 @@ class Pathname
|
|
|
376
431
|
#
|
|
377
432
|
def children: (?boolish with_directory) -> Array[Pathname]
|
|
378
433
|
|
|
434
|
+
# <!--
|
|
435
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
436
|
+
# - pathname.chmod(mode_int) -> integer
|
|
437
|
+
# -->
|
|
379
438
|
# Changes file permissions.
|
|
380
439
|
#
|
|
381
440
|
# See File.chmod.
|
|
382
441
|
#
|
|
383
442
|
def chmod: (Integer mode_int) -> Integer
|
|
384
443
|
|
|
444
|
+
# <!--
|
|
445
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
446
|
+
# - pathname.chown(owner_int, group_int) -> integer
|
|
447
|
+
# -->
|
|
385
448
|
# Change owner and group of the file.
|
|
386
449
|
#
|
|
387
450
|
# See File.chown.
|
|
388
451
|
#
|
|
389
452
|
def chown: (Integer owner, Integer group) -> Integer
|
|
390
453
|
|
|
454
|
+
# <!--
|
|
455
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
456
|
+
# - cleanpath(consider_symlink=false)
|
|
457
|
+
# -->
|
|
391
458
|
# Returns clean pathname of `self` with consecutive slashes and useless dots
|
|
392
459
|
# removed. The filesystem is not accessed.
|
|
393
460
|
#
|
|
@@ -400,6 +467,10 @@ class Pathname
|
|
|
400
467
|
#
|
|
401
468
|
def cleanpath: (?boolish consider_symlink) -> Pathname
|
|
402
469
|
|
|
470
|
+
# <!--
|
|
471
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
472
|
+
# - pathname.ctime -> time
|
|
473
|
+
# -->
|
|
403
474
|
# Returns the last change time, using directory information, not the file
|
|
404
475
|
# itself.
|
|
405
476
|
#
|
|
@@ -407,11 +478,16 @@ class Pathname
|
|
|
407
478
|
#
|
|
408
479
|
def ctime: () -> Time
|
|
409
480
|
|
|
481
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
|
410
482
|
# Removes a file or directory, using File.unlink if `self` is a file, or
|
|
411
483
|
# Dir.unlink as necessary.
|
|
412
484
|
#
|
|
413
485
|
def delete: () -> Integer
|
|
414
486
|
|
|
487
|
+
# <!--
|
|
488
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
489
|
+
# - descend() { |v| ... }
|
|
490
|
+
# -->
|
|
415
491
|
# Iterates over and yields a new Pathname object for each element in the given
|
|
416
492
|
# path in descending order.
|
|
417
493
|
#
|
|
@@ -440,16 +516,28 @@ class Pathname
|
|
|
440
516
|
def descend: () { (Pathname) -> untyped } -> nil
|
|
441
517
|
| () -> Enumerator[Pathname, nil]
|
|
442
518
|
|
|
519
|
+
# <!--
|
|
520
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
521
|
+
# - directory?()
|
|
522
|
+
# -->
|
|
443
523
|
# See FileTest.directory?.
|
|
444
524
|
#
|
|
445
525
|
def directory?: () -> bool
|
|
446
526
|
|
|
527
|
+
# <!--
|
|
528
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
529
|
+
# - dirname()
|
|
530
|
+
# -->
|
|
447
531
|
# Returns all but the last component of the path.
|
|
448
532
|
#
|
|
449
533
|
# See File.dirname.
|
|
450
534
|
#
|
|
451
535
|
def dirname: () -> Pathname
|
|
452
536
|
|
|
537
|
+
# <!--
|
|
538
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
539
|
+
# - each_child(with_directory=true, &b)
|
|
540
|
+
# -->
|
|
453
541
|
# Iterates over the children of the directory (files and subdirectories, not
|
|
454
542
|
# recursive).
|
|
455
543
|
#
|
|
@@ -489,11 +577,19 @@ class Pathname
|
|
|
489
577
|
def each_child: (?boolish with_directory) { (Pathname) -> void } -> Array[Pathname]
|
|
490
578
|
| (?boolish with_directory) -> Enumerator[Pathname, Array[Pathname]]
|
|
491
579
|
|
|
580
|
+
# <!--
|
|
581
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
582
|
+
# - each_entry()
|
|
583
|
+
# -->
|
|
492
584
|
# Iterates over the entries (files and subdirectories) in the directory,
|
|
493
585
|
# yielding a Pathname object for each entry.
|
|
494
586
|
#
|
|
495
587
|
def each_entry: () { (Pathname) -> untyped } -> nil
|
|
496
588
|
|
|
589
|
+
# <!--
|
|
590
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
591
|
+
# - each_filename() { |filename| ... }
|
|
592
|
+
# -->
|
|
497
593
|
# Iterates over each component of the path.
|
|
498
594
|
#
|
|
499
595
|
# Pathname.new("/usr/bin/ruby").each_filename {|filename| ... }
|
|
@@ -509,67 +605,35 @@ class Pathname
|
|
|
509
605
|
def each_filename: () { (String) -> untyped } -> nil
|
|
510
606
|
| () -> Enumerator[String, nil]
|
|
511
607
|
|
|
608
|
+
# <!--
|
|
609
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
610
|
+
# - pathname.each_line {|line| ... }
|
|
611
|
+
# - pathname.each_line(sep=$/ [, open_args]) {|line| block } -> nil
|
|
612
|
+
# - pathname.each_line(limit [, open_args]) {|line| block } -> nil
|
|
613
|
+
# - pathname.each_line(sep, limit [, open_args]) {|line| block } -> nil
|
|
614
|
+
# - pathname.each_line(...) -> an_enumerator
|
|
615
|
+
# -->
|
|
512
616
|
# Iterates over each line in the file and yields a String object for each.
|
|
513
617
|
#
|
|
514
|
-
def each_line: (?String sep, ?Integer limit,
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
?external_encoding: encoding,
|
|
519
|
-
?internal_encoding: encoding,
|
|
520
|
-
?encoding: encoding,
|
|
521
|
-
?textmode: boolish,
|
|
522
|
-
?binmode: boolish,
|
|
523
|
-
?autoclose: boolish,
|
|
524
|
-
# getline_args
|
|
525
|
-
?chomp: boolish,
|
|
526
|
-
) { (String) -> untyped } -> nil
|
|
527
|
-
| (Integer limit,
|
|
528
|
-
# open_args
|
|
529
|
-
?mode: Integer | String,
|
|
530
|
-
?flags: Integer,
|
|
531
|
-
?external_encoding: encoding,
|
|
532
|
-
?internal_encoding: encoding,
|
|
533
|
-
?encoding: encoding,
|
|
534
|
-
?textmode: boolish,
|
|
535
|
-
?binmode: boolish,
|
|
536
|
-
?autoclose: boolish,
|
|
537
|
-
# getline_args
|
|
538
|
-
?chomp: boolish,
|
|
539
|
-
) { (String) -> untyped } -> nil
|
|
540
|
-
| (?String sep, ?Integer limit,
|
|
541
|
-
# open_args
|
|
542
|
-
?mode: Integer | String,
|
|
543
|
-
?flags: Integer,
|
|
544
|
-
?external_encoding: encoding,
|
|
545
|
-
?internal_encoding: encoding,
|
|
546
|
-
?encoding: encoding,
|
|
547
|
-
?textmode: boolish,
|
|
548
|
-
?binmode: boolish,
|
|
549
|
-
?autoclose: boolish,
|
|
550
|
-
# getline_args
|
|
551
|
-
?chomp: boolish,
|
|
552
|
-
) -> Enumerator[String, nil]
|
|
553
|
-
| (Integer limit,
|
|
554
|
-
# open_args
|
|
555
|
-
?mode: Integer | String,
|
|
556
|
-
?flags: Integer,
|
|
557
|
-
?external_encoding: encoding,
|
|
558
|
-
?internal_encoding: encoding,
|
|
559
|
-
?encoding: encoding,
|
|
560
|
-
?textmode: boolish,
|
|
561
|
-
?binmode: boolish,
|
|
562
|
-
?autoclose: boolish,
|
|
563
|
-
# getline_args
|
|
564
|
-
?chomp: boolish,
|
|
565
|
-
) -> Enumerator[String, nil]
|
|
618
|
+
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
|
|
619
|
+
| (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
|
|
620
|
+
| (?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) -> Enumerator[String, nil]
|
|
621
|
+
| (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]
|
|
566
622
|
|
|
623
|
+
# <!--
|
|
624
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
625
|
+
# - empty?()
|
|
626
|
+
# -->
|
|
567
627
|
# Tests the file is empty.
|
|
568
628
|
#
|
|
569
629
|
# See Dir#empty? and FileTest.empty?.
|
|
570
630
|
#
|
|
571
631
|
def empty?: () -> bool
|
|
572
632
|
|
|
633
|
+
# <!--
|
|
634
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
635
|
+
# - entries()
|
|
636
|
+
# -->
|
|
573
637
|
# Return the entries (files and subdirectories) in the directory, each as a
|
|
574
638
|
# Pathname object.
|
|
575
639
|
#
|
|
@@ -597,40 +661,69 @@ class Pathname
|
|
|
597
661
|
#
|
|
598
662
|
def entries: () -> Array[Pathname]
|
|
599
663
|
|
|
664
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
|
600
665
|
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
|
601
666
|
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
|
602
667
|
# file.
|
|
603
668
|
#
|
|
604
669
|
def eql?: (untyped) -> bool
|
|
605
670
|
|
|
671
|
+
# <!--
|
|
672
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
673
|
+
# - executable?()
|
|
674
|
+
# -->
|
|
606
675
|
# See FileTest.executable?.
|
|
607
676
|
#
|
|
608
677
|
def executable?: () -> bool
|
|
609
678
|
|
|
679
|
+
# <!--
|
|
680
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
681
|
+
# - executable_real?()
|
|
682
|
+
# -->
|
|
610
683
|
# See FileTest.executable_real?.
|
|
611
684
|
#
|
|
612
685
|
def executable_real?: () -> bool
|
|
613
686
|
|
|
687
|
+
# <!--
|
|
688
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
689
|
+
# - exist?()
|
|
690
|
+
# -->
|
|
614
691
|
# See FileTest.exist?.
|
|
615
692
|
#
|
|
616
693
|
def exist?: () -> bool
|
|
617
694
|
|
|
695
|
+
# <!--
|
|
696
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
697
|
+
# - expand_path(p1 = v1)
|
|
698
|
+
# -->
|
|
618
699
|
# Returns the absolute path for the file.
|
|
619
700
|
#
|
|
620
701
|
# See File.expand_path.
|
|
621
702
|
#
|
|
622
703
|
def expand_path: (?String dir) -> Pathname
|
|
623
704
|
|
|
705
|
+
# <!--
|
|
706
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
707
|
+
# - extname()
|
|
708
|
+
# -->
|
|
624
709
|
# Returns the file's extension.
|
|
625
710
|
#
|
|
626
711
|
# See File.extname.
|
|
627
712
|
#
|
|
628
713
|
def extname: () -> String
|
|
629
714
|
|
|
715
|
+
# <!--
|
|
716
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
717
|
+
# - file?()
|
|
718
|
+
# -->
|
|
630
719
|
# See FileTest.file?.
|
|
631
720
|
#
|
|
632
721
|
def file?: () -> bool
|
|
633
722
|
|
|
723
|
+
# <!--
|
|
724
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
725
|
+
# - find(ignore_error: true) { |pathname| ... }
|
|
726
|
+
# -->
|
|
634
727
|
# Iterates over the directory tree in a depth first manner, yielding a Pathname
|
|
635
728
|
# for each file under "this" directory.
|
|
636
729
|
#
|
|
@@ -647,30 +740,48 @@ class Pathname
|
|
|
647
740
|
def find: (?ignore_error: boolish) { (Pathname) -> untyped } -> nil
|
|
648
741
|
| (?ignore_error: boolish) -> Enumerator[Pathname, nil]
|
|
649
742
|
|
|
743
|
+
# <!--
|
|
744
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
745
|
+
# - pathname.fnmatch(pattern, [flags]) -> true or false
|
|
746
|
+
# - pathname.fnmatch?(pattern, [flags]) -> true or false
|
|
747
|
+
# -->
|
|
650
748
|
# Return `true` if the receiver matches the given pattern.
|
|
651
749
|
#
|
|
652
750
|
# See File.fnmatch.
|
|
653
751
|
#
|
|
654
752
|
def fnmatch: (String pattern, ?Integer flags) -> bool
|
|
655
753
|
|
|
754
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
|
656
755
|
# Return `true` if the receiver matches the given pattern.
|
|
657
756
|
#
|
|
658
757
|
# See File.fnmatch.
|
|
659
758
|
#
|
|
660
759
|
alias fnmatch? fnmatch
|
|
661
760
|
|
|
761
|
+
# <!--
|
|
762
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
763
|
+
# - pathname.freeze -> obj
|
|
764
|
+
# -->
|
|
662
765
|
# Freezes this Pathname.
|
|
663
766
|
#
|
|
664
767
|
# See Object.freeze.
|
|
665
768
|
#
|
|
666
769
|
def freeze: () -> Pathname
|
|
667
770
|
|
|
771
|
+
# <!--
|
|
772
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
773
|
+
# - pathname.ftype -> string
|
|
774
|
+
# -->
|
|
668
775
|
# Returns "type" of file ("file", "directory", etc).
|
|
669
776
|
#
|
|
670
777
|
# See File.ftype.
|
|
671
778
|
#
|
|
672
779
|
def ftype: () -> String
|
|
673
780
|
|
|
781
|
+
# <!--
|
|
782
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
783
|
+
# - glob(p1, p2 = v2)
|
|
784
|
+
# -->
|
|
674
785
|
# Returns or yields Pathname objects.
|
|
675
786
|
#
|
|
676
787
|
# Pathname("ruby-2.4.2").glob("R*.md")
|
|
@@ -681,6 +792,10 @@ class Pathname
|
|
|
681
792
|
def glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
|
682
793
|
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
|
683
794
|
|
|
795
|
+
# <!--
|
|
796
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
797
|
+
# - grpowned?()
|
|
798
|
+
# -->
|
|
684
799
|
# See FileTest.grpowned?.
|
|
685
800
|
#
|
|
686
801
|
def grpowned?: () -> bool
|
|
@@ -689,6 +804,10 @@ class Pathname
|
|
|
689
804
|
|
|
690
805
|
def inspect: () -> String
|
|
691
806
|
|
|
807
|
+
# <!--
|
|
808
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
809
|
+
# - join(*args)
|
|
810
|
+
# -->
|
|
692
811
|
# Joins the given pathnames onto `self` to create a new Pathname object.
|
|
693
812
|
#
|
|
694
813
|
# path0 = Pathname.new("/usr") # Pathname:/usr
|
|
@@ -700,40 +819,68 @@ class Pathname
|
|
|
700
819
|
#
|
|
701
820
|
def join: (*String | _ToStr | Pathname args) -> Pathname
|
|
702
821
|
|
|
822
|
+
# <!--
|
|
823
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
824
|
+
# - pathname.lchmod(mode_int) -> integer
|
|
825
|
+
# -->
|
|
703
826
|
# Same as Pathname.chmod, but does not follow symbolic links.
|
|
704
827
|
#
|
|
705
828
|
# See File.lchmod.
|
|
706
829
|
#
|
|
707
830
|
def lchmod: (Integer mode) -> Integer
|
|
708
831
|
|
|
832
|
+
# <!--
|
|
833
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
834
|
+
# - pathname.lchown(owner_int, group_int) -> integer
|
|
835
|
+
# -->
|
|
709
836
|
# Same as Pathname.chown, but does not follow symbolic links.
|
|
710
837
|
#
|
|
711
838
|
# See File.lchown.
|
|
712
839
|
#
|
|
713
840
|
def lchown: (Integer owner, Integer group) -> Integer
|
|
714
841
|
|
|
842
|
+
# <!--
|
|
843
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
844
|
+
# - lstat()
|
|
845
|
+
# -->
|
|
715
846
|
# See File.lstat.
|
|
716
847
|
#
|
|
717
848
|
def lstat: () -> ::File::Stat
|
|
718
849
|
|
|
850
|
+
# <!--
|
|
851
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
852
|
+
# - pathname.make_link(old)
|
|
853
|
+
# -->
|
|
719
854
|
# Creates a hard link at *pathname*.
|
|
720
855
|
#
|
|
721
856
|
# See File.link.
|
|
722
857
|
#
|
|
723
858
|
def make_link: (String | Pathname | _ToStr old) -> Integer
|
|
724
859
|
|
|
860
|
+
# <!--
|
|
861
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
862
|
+
# - pathname.make_symlink(old)
|
|
863
|
+
# -->
|
|
725
864
|
# Creates a symbolic link.
|
|
726
865
|
#
|
|
727
866
|
# See File.symlink.
|
|
728
867
|
#
|
|
729
868
|
def make_symlink: (String | Pathname | _ToStr old) -> Integer
|
|
730
869
|
|
|
870
|
+
# <!--
|
|
871
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
872
|
+
# - mkdir(p1 = v1)
|
|
873
|
+
# -->
|
|
731
874
|
# Create the referenced directory.
|
|
732
875
|
#
|
|
733
876
|
# See Dir.mkdir.
|
|
734
877
|
#
|
|
735
878
|
def mkdir: (?Integer perm) -> Integer
|
|
736
879
|
|
|
880
|
+
# <!--
|
|
881
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
882
|
+
# - mkpath(mode: nil)
|
|
883
|
+
# -->
|
|
737
884
|
# Creates a full path, including any intermediate directories that don't yet
|
|
738
885
|
# exist.
|
|
739
886
|
#
|
|
@@ -741,105 +888,130 @@ class Pathname
|
|
|
741
888
|
#
|
|
742
889
|
def mkpath: () -> nil
|
|
743
890
|
|
|
891
|
+
# <!--
|
|
892
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
893
|
+
# - mountpoint?()
|
|
894
|
+
# -->
|
|
744
895
|
# Returns `true` if `self` points to a mountpoint.
|
|
745
896
|
#
|
|
746
897
|
def mountpoint?: () -> bool
|
|
747
898
|
|
|
899
|
+
# <!--
|
|
900
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
901
|
+
# - pathname.mtime -> time
|
|
902
|
+
# -->
|
|
748
903
|
# Returns the last modified time of the file.
|
|
749
904
|
#
|
|
750
905
|
# See File.mtime.
|
|
751
906
|
#
|
|
752
907
|
def mtime: () -> Time
|
|
753
908
|
|
|
909
|
+
# <!--
|
|
910
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
911
|
+
# - pathname.open()
|
|
912
|
+
# - pathname.open(mode="r" [, opt]) -> file
|
|
913
|
+
# - pathname.open([mode [, perm]] [, opt]) -> file
|
|
914
|
+
# - pathname.open(mode="r" [, opt]) {|file| block } -> obj
|
|
915
|
+
# - pathname.open([mode [, perm]] [, opt]) {|file| block } -> obj
|
|
916
|
+
# -->
|
|
754
917
|
# Opens the file for reading or writing.
|
|
755
918
|
#
|
|
756
919
|
# See File.open.
|
|
757
920
|
#
|
|
758
|
-
def open: (?
|
|
759
|
-
| [T] (?
|
|
921
|
+
def open: (?string | int mode, ?int perm) -> File
|
|
922
|
+
| [T] (?string | int mode, ?int perm) { (File) -> T } -> T
|
|
760
923
|
|
|
924
|
+
# <!--
|
|
925
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
926
|
+
# - opendir()
|
|
927
|
+
# -->
|
|
761
928
|
# Opens the referenced directory.
|
|
762
929
|
#
|
|
763
930
|
# See Dir.open.
|
|
764
931
|
#
|
|
765
932
|
def opendir: () -> Dir
|
|
766
|
-
|
|
933
|
+
| [U] () { (Dir) -> U } -> U
|
|
767
934
|
|
|
935
|
+
# <!--
|
|
936
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
937
|
+
# - owned?()
|
|
938
|
+
# -->
|
|
768
939
|
# See FileTest.owned?.
|
|
769
940
|
#
|
|
770
941
|
def owned?: () -> bool
|
|
771
942
|
|
|
943
|
+
# <!--
|
|
944
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
945
|
+
# - parent()
|
|
946
|
+
# -->
|
|
772
947
|
# Returns the parent directory.
|
|
773
948
|
#
|
|
774
949
|
# This is same as `self + '..'`.
|
|
775
950
|
#
|
|
776
951
|
def parent: () -> Pathname
|
|
777
952
|
|
|
953
|
+
# <!--
|
|
954
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
955
|
+
# - pipe?()
|
|
956
|
+
# -->
|
|
778
957
|
# See FileTest.pipe?.
|
|
779
958
|
#
|
|
780
959
|
def pipe?: () -> bool
|
|
781
960
|
|
|
961
|
+
# <!--
|
|
962
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
963
|
+
# - pathname.read([length [, offset]]) -> string
|
|
964
|
+
# - pathname.read([length [, offset]], open_args) -> string
|
|
965
|
+
# -->
|
|
782
966
|
# Returns all data from the file, or the first `N` bytes if specified.
|
|
783
967
|
#
|
|
784
968
|
# See File.read.
|
|
785
969
|
#
|
|
786
|
-
def read: (?Integer length, ?Integer offset,
|
|
787
|
-
# open_args
|
|
788
|
-
?mode: Integer | String,
|
|
789
|
-
?flags: Integer,
|
|
790
|
-
?external_encoding: encoding,
|
|
791
|
-
?internal_encoding: encoding,
|
|
792
|
-
?encoding: encoding,
|
|
793
|
-
?textmode: boolish,
|
|
794
|
-
?binmode: boolish,
|
|
795
|
-
?autoclose: boolish,
|
|
796
|
-
) -> String
|
|
970
|
+
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
|
|
797
971
|
|
|
972
|
+
# <!--
|
|
973
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
974
|
+
# - readable?()
|
|
975
|
+
# -->
|
|
798
976
|
# See FileTest.readable?.
|
|
799
977
|
#
|
|
800
978
|
def readable?: () -> bool
|
|
801
979
|
|
|
980
|
+
# <!--
|
|
981
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
982
|
+
# - readable_real?()
|
|
983
|
+
# -->
|
|
802
984
|
# See FileTest.readable_real?.
|
|
803
985
|
#
|
|
804
986
|
def readable_real?: () -> bool
|
|
805
987
|
|
|
988
|
+
# <!--
|
|
989
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
990
|
+
# - pathname.readlines(sep=$/ [, open_args]) -> array
|
|
991
|
+
# - pathname.readlines(limit [, open_args]) -> array
|
|
992
|
+
# - pathname.readlines(sep, limit [, open_args]) -> array
|
|
993
|
+
# -->
|
|
806
994
|
# Returns all the lines from the file.
|
|
807
995
|
#
|
|
808
996
|
# See File.readlines.
|
|
809
997
|
#
|
|
810
|
-
def readlines: (?String sep, ?Integer limit,
|
|
811
|
-
|
|
812
|
-
?mode: Integer | String,
|
|
813
|
-
?flags: Integer,
|
|
814
|
-
?external_encoding: encoding,
|
|
815
|
-
?internal_encoding: encoding,
|
|
816
|
-
?encoding: encoding,
|
|
817
|
-
?textmode: boolish,
|
|
818
|
-
?binmode: boolish,
|
|
819
|
-
?autoclose: boolish,
|
|
820
|
-
# getline_args
|
|
821
|
-
?chomp: boolish,
|
|
822
|
-
) -> Array[String]
|
|
823
|
-
| (Integer limit,
|
|
824
|
-
# open_args
|
|
825
|
-
?mode: Integer | String,
|
|
826
|
-
?flags: Integer,
|
|
827
|
-
?external_encoding: encoding,
|
|
828
|
-
?internal_encoding: encoding,
|
|
829
|
-
?encoding: encoding,
|
|
830
|
-
?textmode: boolish,
|
|
831
|
-
?binmode: boolish,
|
|
832
|
-
?autoclose: boolish,
|
|
833
|
-
# getline_args
|
|
834
|
-
?chomp: boolish,
|
|
835
|
-
) -> Array[String]
|
|
998
|
+
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]
|
|
999
|
+
| (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]
|
|
836
1000
|
|
|
1001
|
+
# <!--
|
|
1002
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1003
|
+
# - readlink()
|
|
1004
|
+
# -->
|
|
837
1005
|
# Read symbolic link.
|
|
838
1006
|
#
|
|
839
1007
|
# See File.readlink.
|
|
840
1008
|
#
|
|
841
1009
|
def readlink: () -> untyped
|
|
842
1010
|
|
|
1011
|
+
# <!--
|
|
1012
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1013
|
+
# - realdirpath(p1 = v1)
|
|
1014
|
+
# -->
|
|
843
1015
|
# Returns the real (absolute) pathname of `self` in the actual filesystem.
|
|
844
1016
|
#
|
|
845
1017
|
# Does not contain symlinks or useless dots, `..` and `.`.
|
|
@@ -848,6 +1020,10 @@ class Pathname
|
|
|
848
1020
|
#
|
|
849
1021
|
def realdirpath: (?string | Pathname base_dir) -> Pathname
|
|
850
1022
|
|
|
1023
|
+
# <!--
|
|
1024
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1025
|
+
# - realpath(p1 = v1)
|
|
1026
|
+
# -->
|
|
851
1027
|
# Returns the real (absolute) pathname for `self` in the actual filesystem.
|
|
852
1028
|
#
|
|
853
1029
|
# Does not contain symlinks or useless dots, `..` and `.`.
|
|
@@ -856,6 +1032,10 @@ class Pathname
|
|
|
856
1032
|
#
|
|
857
1033
|
def realpath: (?string | Pathname base_dir) -> Pathname
|
|
858
1034
|
|
|
1035
|
+
# <!--
|
|
1036
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
1037
|
+
# - relative?()
|
|
1038
|
+
# -->
|
|
859
1039
|
# The opposite of Pathname#absolute?
|
|
860
1040
|
#
|
|
861
1041
|
# It returns `false` if the pathname begins with a slash.
|
|
@@ -870,6 +1050,10 @@ class Pathname
|
|
|
870
1050
|
#
|
|
871
1051
|
def relative?: () -> bool
|
|
872
1052
|
|
|
1053
|
+
# <!--
|
|
1054
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
1055
|
+
# - relative_path_from(base_directory)
|
|
1056
|
+
# -->
|
|
873
1057
|
# Returns a relative path from the given `base_directory` to the receiver.
|
|
874
1058
|
#
|
|
875
1059
|
# If `self` is absolute, then `base_directory` must be absolute too.
|
|
@@ -880,26 +1064,45 @@ class Pathname
|
|
|
880
1064
|
#
|
|
881
1065
|
# ArgumentError is raised when it cannot find a relative path.
|
|
882
1066
|
#
|
|
1067
|
+
# Note that this method does not handle situations where the case sensitivity of
|
|
1068
|
+
# the filesystem in use differs from the operating system default.
|
|
1069
|
+
#
|
|
883
1070
|
def relative_path_from: (Pathname | string base_directory) -> Pathname
|
|
884
1071
|
|
|
1072
|
+
# <!--
|
|
1073
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1074
|
+
# - rename(p1)
|
|
1075
|
+
# -->
|
|
885
1076
|
# Rename the file.
|
|
886
1077
|
#
|
|
887
1078
|
# See File.rename.
|
|
888
1079
|
#
|
|
889
1080
|
def rename: (Pathname | string new_name) -> 0
|
|
890
1081
|
|
|
1082
|
+
# <!--
|
|
1083
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1084
|
+
# - rmdir()
|
|
1085
|
+
# -->
|
|
891
1086
|
# Remove the referenced directory.
|
|
892
1087
|
#
|
|
893
1088
|
# See Dir.rmdir.
|
|
894
1089
|
#
|
|
895
1090
|
def rmdir: () -> 0
|
|
896
1091
|
|
|
1092
|
+
# <!--
|
|
1093
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
1094
|
+
# - rmtree()
|
|
1095
|
+
# -->
|
|
897
1096
|
# Recursively deletes a directory, including all directories beneath it.
|
|
898
1097
|
#
|
|
899
1098
|
# See FileUtils.rm_r
|
|
900
1099
|
#
|
|
901
1100
|
def rmtree: () -> void
|
|
902
1101
|
|
|
1102
|
+
# <!--
|
|
1103
|
+
# rdoc-file=ext/pathname/lib/pathname.rb
|
|
1104
|
+
# - root?()
|
|
1105
|
+
# -->
|
|
903
1106
|
# Predicate method for root directories. Returns `true` if the pathname
|
|
904
1107
|
# consists of consecutive slashes.
|
|
905
1108
|
#
|
|
@@ -908,42 +1111,78 @@ class Pathname
|
|
|
908
1111
|
#
|
|
909
1112
|
def root?: () -> bool
|
|
910
1113
|
|
|
1114
|
+
# <!--
|
|
1115
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1116
|
+
# - setgid?()
|
|
1117
|
+
# -->
|
|
911
1118
|
# See FileTest.setgid?.
|
|
912
1119
|
#
|
|
913
1120
|
def setgid?: () -> bool
|
|
914
1121
|
|
|
1122
|
+
# <!--
|
|
1123
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1124
|
+
# - setuid?()
|
|
1125
|
+
# -->
|
|
915
1126
|
# See FileTest.setuid?.
|
|
916
1127
|
#
|
|
917
1128
|
def setuid?: () -> bool
|
|
918
1129
|
|
|
1130
|
+
# <!--
|
|
1131
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1132
|
+
# - size()
|
|
1133
|
+
# -->
|
|
919
1134
|
# See FileTest.size.
|
|
920
1135
|
#
|
|
921
1136
|
def size: () -> Integer
|
|
922
1137
|
|
|
1138
|
+
# <!--
|
|
1139
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1140
|
+
# - size?()
|
|
1141
|
+
# -->
|
|
923
1142
|
# See FileTest.size?.
|
|
924
1143
|
#
|
|
925
1144
|
def size?: () -> Integer?
|
|
926
1145
|
|
|
1146
|
+
# <!--
|
|
1147
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1148
|
+
# - socket?()
|
|
1149
|
+
# -->
|
|
927
1150
|
# See FileTest.socket?.
|
|
928
1151
|
#
|
|
929
1152
|
def socket?: () -> untyped
|
|
930
1153
|
|
|
1154
|
+
# <!--
|
|
1155
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1156
|
+
# - split()
|
|
1157
|
+
# -->
|
|
931
1158
|
# Returns the #dirname and the #basename in an Array.
|
|
932
1159
|
#
|
|
933
1160
|
# See File.split.
|
|
934
1161
|
#
|
|
935
|
-
def split: () -> [Pathname, Pathname]
|
|
1162
|
+
def split: () -> [ Pathname, Pathname ]
|
|
936
1163
|
|
|
1164
|
+
# <!--
|
|
1165
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1166
|
+
# - stat()
|
|
1167
|
+
# -->
|
|
937
1168
|
# Returns a File::Stat object.
|
|
938
1169
|
#
|
|
939
1170
|
# See File.stat.
|
|
940
1171
|
#
|
|
941
1172
|
def stat: () -> File::Stat
|
|
942
1173
|
|
|
1174
|
+
# <!--
|
|
1175
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1176
|
+
# - sticky?()
|
|
1177
|
+
# -->
|
|
943
1178
|
# See FileTest.sticky?.
|
|
944
1179
|
#
|
|
945
1180
|
def sticky?: () -> untyped
|
|
946
1181
|
|
|
1182
|
+
# <!--
|
|
1183
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1184
|
+
# - sub(*args)
|
|
1185
|
+
# -->
|
|
947
1186
|
# Return a pathname which is substituted by String#sub.
|
|
948
1187
|
#
|
|
949
1188
|
# path1 = Pathname.new('/usr/bin/perl')
|
|
@@ -953,6 +1192,10 @@ class Pathname
|
|
|
953
1192
|
def sub: (Regexp | string pattern, string | Hash[String, String] replacement) -> Pathname
|
|
954
1193
|
| (Regexp | string pattern) { (String match) -> string } -> Pathname
|
|
955
1194
|
|
|
1195
|
+
# <!--
|
|
1196
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1197
|
+
# - sub_ext(p1)
|
|
1198
|
+
# -->
|
|
956
1199
|
# Return a pathname with `repl` added as a suffix to the basename.
|
|
957
1200
|
#
|
|
958
1201
|
# If self has no extension part, `repl` is appended.
|
|
@@ -962,83 +1205,132 @@ class Pathname
|
|
|
962
1205
|
#
|
|
963
1206
|
def sub_ext: (string replacement) -> Pathname
|
|
964
1207
|
|
|
1208
|
+
# <!--
|
|
1209
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1210
|
+
# - symlink?()
|
|
1211
|
+
# -->
|
|
965
1212
|
# See FileTest.symlink?.
|
|
966
1213
|
#
|
|
967
1214
|
def symlink?: () -> untyped
|
|
968
1215
|
|
|
1216
|
+
# <!--
|
|
1217
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1218
|
+
# - pathname.sysopen([mode, [perm]]) -> fixnum
|
|
1219
|
+
# -->
|
|
969
1220
|
# See IO.sysopen.
|
|
970
1221
|
#
|
|
971
1222
|
def sysopen: (?String mode, ?Integer perm) -> Integer
|
|
972
1223
|
|
|
1224
|
+
# <!--
|
|
1225
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1226
|
+
# - pathname.taint -> obj
|
|
1227
|
+
# -->
|
|
973
1228
|
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
|
974
1229
|
#
|
|
975
1230
|
def taint: () -> Pathname
|
|
976
1231
|
|
|
1232
|
+
# <!-- rdoc-file=ext/pathname/pathname.c -->
|
|
977
1233
|
# Return the path as a String.
|
|
978
1234
|
#
|
|
979
1235
|
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
|
980
1236
|
#
|
|
981
1237
|
def to_path: () -> String
|
|
982
1238
|
|
|
1239
|
+
# <!--
|
|
1240
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1241
|
+
# - pathname.to_s -> string
|
|
1242
|
+
# - pathname.to_path -> string
|
|
1243
|
+
# -->
|
|
983
1244
|
# Return the path as a String.
|
|
984
1245
|
#
|
|
985
1246
|
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
|
986
1247
|
#
|
|
987
1248
|
alias to_s to_path
|
|
988
1249
|
|
|
1250
|
+
# <!--
|
|
1251
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1252
|
+
# - truncate(p1)
|
|
1253
|
+
# -->
|
|
989
1254
|
# Truncates the file to `length` bytes.
|
|
990
1255
|
#
|
|
991
1256
|
# See File.truncate.
|
|
992
1257
|
#
|
|
993
1258
|
def truncate: (Integer length) -> 0
|
|
994
1259
|
|
|
1260
|
+
# <!--
|
|
1261
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1262
|
+
# - unlink()
|
|
1263
|
+
# -->
|
|
995
1264
|
# Removes a file or directory, using File.unlink if `self` is a file, or
|
|
996
1265
|
# Dir.unlink as necessary.
|
|
997
1266
|
#
|
|
998
1267
|
def unlink: () -> Integer
|
|
999
1268
|
|
|
1269
|
+
# <!--
|
|
1270
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1271
|
+
# - pathname.untaint -> obj
|
|
1272
|
+
# -->
|
|
1000
1273
|
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
|
1001
1274
|
#
|
|
1002
1275
|
def untaint: () -> Pathname
|
|
1003
1276
|
|
|
1277
|
+
# <!--
|
|
1278
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1279
|
+
# - utime(p1, p2)
|
|
1280
|
+
# -->
|
|
1004
1281
|
# Update the access and modification times of the file.
|
|
1005
1282
|
#
|
|
1006
1283
|
# See File.utime.
|
|
1007
1284
|
#
|
|
1008
1285
|
def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
|
|
1009
1286
|
|
|
1287
|
+
# <!--
|
|
1288
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1289
|
+
# - world_readable?()
|
|
1290
|
+
# -->
|
|
1010
1291
|
# See FileTest.world_readable?.
|
|
1011
1292
|
#
|
|
1012
1293
|
def world_readable?: () -> (Integer | nil)
|
|
1013
1294
|
|
|
1295
|
+
# <!--
|
|
1296
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1297
|
+
# - world_writable?()
|
|
1298
|
+
# -->
|
|
1014
1299
|
# See FileTest.world_writable?.
|
|
1015
1300
|
#
|
|
1016
1301
|
def world_writable?: () -> (Integer | nil)
|
|
1017
1302
|
|
|
1303
|
+
# <!--
|
|
1304
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1305
|
+
# - writable?()
|
|
1306
|
+
# -->
|
|
1018
1307
|
# See FileTest.writable?.
|
|
1019
1308
|
#
|
|
1020
1309
|
def writable?: () -> bool
|
|
1021
1310
|
|
|
1311
|
+
# <!--
|
|
1312
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1313
|
+
# - writable_real?()
|
|
1314
|
+
# -->
|
|
1022
1315
|
# See FileTest.writable_real?.
|
|
1023
1316
|
#
|
|
1024
1317
|
def writable_real?: () -> bool
|
|
1025
1318
|
|
|
1319
|
+
# <!--
|
|
1320
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1321
|
+
# - pathname.write(string, [offset] ) => fixnum
|
|
1322
|
+
# - pathname.write(string, [offset], open_args ) => fixnum
|
|
1323
|
+
# -->
|
|
1026
1324
|
# Writes `contents` to the file.
|
|
1027
1325
|
#
|
|
1028
1326
|
# See File.write.
|
|
1029
1327
|
#
|
|
1030
|
-
def write: (String content, ?Integer offset,
|
|
1031
|
-
# open_args
|
|
1032
|
-
?mode: Integer | String,
|
|
1033
|
-
?flags: Integer,
|
|
1034
|
-
?external_encoding: encoding,
|
|
1035
|
-
?internal_encoding: encoding,
|
|
1036
|
-
?encoding: encoding,
|
|
1037
|
-
?textmode: boolish,
|
|
1038
|
-
?binmode: boolish,
|
|
1039
|
-
?autoclose: boolish,
|
|
1040
|
-
) -> Integer
|
|
1328
|
+
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
|
|
1041
1329
|
|
|
1330
|
+
# <!--
|
|
1331
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1332
|
+
# - zero?()
|
|
1333
|
+
# -->
|
|
1042
1334
|
# See FileTest.zero?.
|
|
1043
1335
|
#
|
|
1044
1336
|
def zero?: () -> bool
|
|
@@ -1057,6 +1349,10 @@ class Pathname
|
|
|
1057
1349
|
|
|
1058
1350
|
def has_trailing_separator?: (untyped path) -> untyped
|
|
1059
1351
|
|
|
1352
|
+
# <!--
|
|
1353
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1354
|
+
# - new(p1)
|
|
1355
|
+
# -->
|
|
1060
1356
|
# Create a Pathname object from the given String (or String-like object). If
|
|
1061
1357
|
# `path` contains a NULL character (`\0`), an ArgumentError is raised.
|
|
1062
1358
|
#
|
|
@@ -1077,9 +1373,14 @@ class Pathname
|
|
|
1077
1373
|
TO_PATH: Symbol
|
|
1078
1374
|
end
|
|
1079
1375
|
|
|
1376
|
+
%a{annotate:rdoc:skip}
|
|
1080
1377
|
module Kernel
|
|
1081
1378
|
private
|
|
1082
1379
|
|
|
1380
|
+
# <!--
|
|
1381
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1382
|
+
# - Pathname(path) -> pathname
|
|
1383
|
+
# -->
|
|
1083
1384
|
# Creates a new Pathname object from the given string, `path`, and returns
|
|
1084
1385
|
# pathname object.
|
|
1085
1386
|
#
|