rbs 4.0.0.dev.4 → 4.0.0.dev.5
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/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +11 -8
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +17 -34
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/valgrind.yml +42 -0
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +1 -1
- data/README.md +1 -1
- data/Rakefile +32 -5
- data/config.yml +46 -0
- data/core/array.rbs +96 -46
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/comparable.rbs +13 -6
- data/core/complex.rbs +55 -41
- data/core/dir.rbs +4 -4
- data/core/encoding.rbs +7 -10
- data/core/enumerable.rbs +90 -3
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +63 -1
- data/core/errno.rbs +8 -0
- data/core/errors.rbs +28 -1
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +40 -20
- data/core/file.rbs +108 -78
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +225 -69
- data/core/gc.rbs +417 -281
- data/core/hash.rbs +1023 -727
- data/core/integer.rbs +104 -110
- data/core/io/buffer.rbs +21 -10
- data/core/io/wait.rbs +11 -33
- data/core/io.rbs +82 -19
- data/core/kernel.rbs +70 -59
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +42 -3
- data/core/method.rbs +63 -27
- data/core/module.rbs +103 -26
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +43 -35
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +21 -15
- data/core/pathname.rbs +1272 -0
- data/core/proc.rbs +30 -25
- data/core/process.rbs +4 -2
- data/core/ractor.rbs +361 -509
- data/core/random.rbs +17 -0
- data/core/range.rbs +113 -16
- data/core/rational.rbs +56 -85
- data/core/rbs/unnamed/argf.rbs +2 -2
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +4 -113
- data/core/regexp.rbs +25 -20
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +6 -4
- data/core/rubygems/errors.rbs +3 -70
- data/core/rubygems/rubygems.rbs +11 -79
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +488 -359
- data/core/signal.rbs +24 -14
- data/core/string.rbs +3171 -1241
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +17 -11
- data/core/thread.rbs +95 -33
- data/core/time.rbs +35 -9
- data/core/trace_point.rbs +7 -4
- data/core/unbound_method.rbs +14 -6
- data/docs/aliases.md +79 -0
- data/docs/collection.md +2 -2
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +470 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +33 -4
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +77 -3
- data/ext/rbs_extension/ast_translation.h +3 -0
- data/ext/rbs_extension/class_constants.c +8 -2
- data/ext/rbs_extension/class_constants.h +4 -0
- data/ext/rbs_extension/extconf.rb +5 -1
- data/ext/rbs_extension/legacy_location.c +5 -5
- data/ext/rbs_extension/main.c +37 -20
- data/include/rbs/ast.h +85 -38
- data/include/rbs/defines.h +27 -0
- data/include/rbs/lexer.h +30 -11
- data/include/rbs/parser.h +6 -6
- data/include/rbs/string.h +0 -2
- data/include/rbs/util/rbs_allocator.h +34 -13
- data/include/rbs/util/rbs_assert.h +12 -1
- data/include/rbs/util/rbs_encoding.h +2 -0
- data/include/rbs/util/rbs_unescape.h +2 -1
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +137 -0
- data/lib/rbs/ast/ruby/comment_block.rb +24 -0
- data/lib/rbs/ast/ruby/declarations.rb +198 -3
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
- data/lib/rbs/ast/ruby/members.rb +159 -1
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +20 -15
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +38 -51
- data/lib/rbs/cli.rb +52 -19
- data/lib/rbs/collection/config/lockfile_generator.rb +8 -0
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
- data/lib/rbs/definition_builder/method_builder.rb +20 -0
- data/lib/rbs/definition_builder.rb +91 -2
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment.rb +227 -74
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/errors.rb +27 -7
- data/lib/rbs/inline_parser.rb +341 -5
- data/lib/rbs/location_aux.rb +1 -1
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/parser_aux.rb +2 -2
- data/lib/rbs/prototype/rb.rb +2 -2
- data/lib/rbs/prototype/rbi.rb +2 -0
- data/lib/rbs/prototype/runtime.rb +8 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +116 -38
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +16 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +27 -27
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +3 -2
- data/schema/typeParam.json +17 -1
- data/sig/ast/ruby/annotations.rbs +124 -0
- data/sig/ast/ruby/comment_block.rbs +8 -0
- data/sig/ast/ruby/declarations.rbs +102 -4
- data/sig/ast/ruby/members.rbs +87 -1
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +13 -4
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -1
- data/sig/environment.rbs +70 -12
- data/sig/errors.rbs +13 -6
- data/sig/inline_parser.rbs +39 -2
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -1
- data/sig/method_builder.rbs +3 -1
- data/sig/method_types.rbs +1 -1
- data/sig/parser.rbs +16 -2
- data/sig/resolver/type_name_resolver.rbs +35 -7
- data/sig/source.rbs +3 -3
- data/sig/type_param.rbs +13 -8
- data/sig/types.rbs +4 -4
- data/src/ast.c +80 -1
- data/src/lexer.c +1392 -1313
- data/src/lexer.re +3 -0
- data/src/lexstate.c +58 -37
- data/src/location.c +4 -4
- data/src/parser.c +412 -145
- data/src/string.c +0 -48
- data/src/util/rbs_allocator.c +89 -71
- data/src/util/rbs_assert.c +1 -1
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +10 -10
- data/src/util/rbs_encoding.c +4 -8
- data/src/util/rbs_unescape.c +56 -20
- data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +3 -1
- data/stdlib/date/0/date.rbs +67 -59
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +737 -347
- data/stdlib/fileutils/0/fileutils.rbs +20 -14
- data/stdlib/forwardable/0/forwardable.rbs +3 -0
- data/stdlib/json/0/json.rbs +82 -28
- data/stdlib/net-http/0/net-http.rbs +3 -0
- data/stdlib/objspace/0/objspace.rbs +9 -27
- data/stdlib/open-uri/0/open-uri.rbs +40 -0
- data/stdlib/open3/0/open3.rbs +459 -1
- data/stdlib/openssl/0/openssl.rbs +331 -228
- data/stdlib/optparse/0/optparse.rbs +8 -3
- data/stdlib/pathname/0/pathname.rbs +9 -1379
- data/stdlib/psych/0/psych.rbs +4 -4
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -1
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +2 -2
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +6 -19
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/socket.rbs +13 -1
- data/stdlib/socket/0/tcp_socket.rbs +10 -2
- data/stdlib/stringio/0/stringio.rbs +1176 -85
- data/stdlib/strscan/0/string_scanner.rbs +31 -31
- data/stdlib/tempfile/0/tempfile.rbs +3 -3
- data/stdlib/time/0/time.rbs +1 -1
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/uri/0/common.rbs +16 -2
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +24 -16
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
- data/stdlib/zlib/0/gzip_reader.rbs +2 -2
- data/stdlib/zlib/0/gzip_writer.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +30 -4
data/core/pathname.rbs
ADDED
|
@@ -0,0 +1,1272 @@
|
|
|
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 -->
|
|
16
|
+
# Pathname represents the name of a file or directory on the filesystem, but not
|
|
17
|
+
# the file itself.
|
|
18
|
+
#
|
|
19
|
+
# The pathname depends on the Operating System: Unix, Windows, etc. This library
|
|
20
|
+
# works with pathnames of local OS, however non-Unix pathnames are supported
|
|
21
|
+
# experimentally.
|
|
22
|
+
#
|
|
23
|
+
# A Pathname can be relative or absolute. It's not until you try to reference
|
|
24
|
+
# the file that it even matters whether the file exists or not.
|
|
25
|
+
#
|
|
26
|
+
# Pathname is immutable. It has no method for destructive update.
|
|
27
|
+
#
|
|
28
|
+
# The goal of this class is to manipulate file path information in a neater way
|
|
29
|
+
# than standard Ruby provides. The examples below demonstrate the difference.
|
|
30
|
+
#
|
|
31
|
+
# **All** functionality from File, FileTest, and some from Dir and FileUtils is
|
|
32
|
+
# included, in an unsurprising way. It is essentially a facade for all of
|
|
33
|
+
# these, and more.
|
|
34
|
+
#
|
|
35
|
+
# ## Examples
|
|
36
|
+
#
|
|
37
|
+
# ### Example 1: Using Pathname
|
|
38
|
+
#
|
|
39
|
+
# require 'pathname'
|
|
40
|
+
# pn = Pathname.new("/usr/bin/ruby")
|
|
41
|
+
# size = pn.size # 27662
|
|
42
|
+
# isdir = pn.directory? # false
|
|
43
|
+
# dir = pn.dirname # Pathname:/usr/bin
|
|
44
|
+
# base = pn.basename # Pathname:ruby
|
|
45
|
+
# dir, base = pn.split # [Pathname:/usr/bin, Pathname:ruby]
|
|
46
|
+
# data = pn.read
|
|
47
|
+
# pn.open { |f| _ }
|
|
48
|
+
# pn.each_line { |line| _ }
|
|
49
|
+
#
|
|
50
|
+
# ### Example 2: Using standard Ruby
|
|
51
|
+
#
|
|
52
|
+
# pn = "/usr/bin/ruby"
|
|
53
|
+
# size = File.size(pn) # 27662
|
|
54
|
+
# isdir = File.directory?(pn) # false
|
|
55
|
+
# dir = File.dirname(pn) # "/usr/bin"
|
|
56
|
+
# base = File.basename(pn) # "ruby"
|
|
57
|
+
# dir, base = File.split(pn) # ["/usr/bin", "ruby"]
|
|
58
|
+
# data = File.read(pn)
|
|
59
|
+
# File.open(pn) { |f| _ }
|
|
60
|
+
# File.foreach(pn) { |line| _ }
|
|
61
|
+
#
|
|
62
|
+
# ### Example 3: Special features
|
|
63
|
+
#
|
|
64
|
+
# p1 = Pathname.new("/usr/lib") # Pathname:/usr/lib
|
|
65
|
+
# p2 = p1 + "ruby/1.8" # Pathname:/usr/lib/ruby/1.8
|
|
66
|
+
# p3 = p1.parent # Pathname:/usr
|
|
67
|
+
# p4 = p2.relative_path_from(p3) # Pathname:lib/ruby/1.8
|
|
68
|
+
# pwd = Pathname.pwd # Pathname:/home/gavin
|
|
69
|
+
# pwd.absolute? # true
|
|
70
|
+
# p5 = Pathname.new "." # Pathname:.
|
|
71
|
+
# p5 = p5 + "music/../articles" # Pathname:music/../articles
|
|
72
|
+
# p5.cleanpath # Pathname:articles
|
|
73
|
+
# p5.realpath # Pathname:/home/gavin/articles
|
|
74
|
+
# p5.children # [Pathname:/home/gavin/articles/linux, ...]
|
|
75
|
+
#
|
|
76
|
+
# ## Breakdown of functionality
|
|
77
|
+
#
|
|
78
|
+
# ### Core methods
|
|
79
|
+
#
|
|
80
|
+
# These methods are effectively manipulating a String, because that's all a path
|
|
81
|
+
# is. None of these access the file system except for #mountpoint?, #children,
|
|
82
|
+
# #each_child, #realdirpath and #realpath.
|
|
83
|
+
#
|
|
84
|
+
# * +
|
|
85
|
+
# * #join
|
|
86
|
+
# * #parent
|
|
87
|
+
# * #root?
|
|
88
|
+
# * #absolute?
|
|
89
|
+
# * #relative?
|
|
90
|
+
# * #relative_path_from
|
|
91
|
+
# * #each_filename
|
|
92
|
+
# * #cleanpath
|
|
93
|
+
# * #realpath
|
|
94
|
+
# * #realdirpath
|
|
95
|
+
# * #children
|
|
96
|
+
# * #each_child
|
|
97
|
+
# * #mountpoint?
|
|
98
|
+
#
|
|
99
|
+
# ### File status predicate methods
|
|
100
|
+
#
|
|
101
|
+
# These methods are a facade for FileTest:
|
|
102
|
+
# * #blockdev?
|
|
103
|
+
# * #chardev?
|
|
104
|
+
# * #directory?
|
|
105
|
+
# * #executable?
|
|
106
|
+
# * #executable_real?
|
|
107
|
+
# * #exist?
|
|
108
|
+
# * #file?
|
|
109
|
+
# * #grpowned?
|
|
110
|
+
# * #owned?
|
|
111
|
+
# * #pipe?
|
|
112
|
+
# * #readable?
|
|
113
|
+
# * #world_readable?
|
|
114
|
+
# * #readable_real?
|
|
115
|
+
# * #setgid?
|
|
116
|
+
# * #setuid?
|
|
117
|
+
# * #size
|
|
118
|
+
# * #size?
|
|
119
|
+
# * #socket?
|
|
120
|
+
# * #sticky?
|
|
121
|
+
# * #symlink?
|
|
122
|
+
# * #writable?
|
|
123
|
+
# * #world_writable?
|
|
124
|
+
# * #writable_real?
|
|
125
|
+
# * #zero?
|
|
126
|
+
#
|
|
127
|
+
# ### File property and manipulation methods
|
|
128
|
+
#
|
|
129
|
+
# These methods are a facade for File:
|
|
130
|
+
# * #each_line(*args, &block)
|
|
131
|
+
# * #read(*args)
|
|
132
|
+
# * #binread(*args)
|
|
133
|
+
# * #readlines(*args)
|
|
134
|
+
# * #sysopen(*args)
|
|
135
|
+
# * #write(*args)
|
|
136
|
+
# * #binwrite(*args)
|
|
137
|
+
# * #atime
|
|
138
|
+
# * #birthtime
|
|
139
|
+
# * #ctime
|
|
140
|
+
# * #mtime
|
|
141
|
+
# * #chmod(mode)
|
|
142
|
+
# * #lchmod(mode)
|
|
143
|
+
# * #chown(owner, group)
|
|
144
|
+
# * #lchown(owner, group)
|
|
145
|
+
# * #fnmatch(pattern, *args)
|
|
146
|
+
# * #fnmatch?(pattern, *args)
|
|
147
|
+
# * #ftype
|
|
148
|
+
# * #make_link(old)
|
|
149
|
+
# * #open(*args, &block)
|
|
150
|
+
# * #readlink
|
|
151
|
+
# * #rename(to)
|
|
152
|
+
# * #stat
|
|
153
|
+
# * #lstat
|
|
154
|
+
# * #make_symlink(old)
|
|
155
|
+
# * #truncate(length)
|
|
156
|
+
# * #utime(atime, mtime)
|
|
157
|
+
# * #lutime(atime, mtime)
|
|
158
|
+
# * #basename(*args)
|
|
159
|
+
# * #dirname
|
|
160
|
+
# * #extname
|
|
161
|
+
# * #expand_path(*args)
|
|
162
|
+
# * #split
|
|
163
|
+
#
|
|
164
|
+
# ### Directory methods
|
|
165
|
+
#
|
|
166
|
+
# These methods are a facade for Dir:
|
|
167
|
+
# * Pathname.glob(*args)
|
|
168
|
+
# * Pathname.getwd / Pathname.pwd
|
|
169
|
+
# * #rmdir
|
|
170
|
+
# * #entries
|
|
171
|
+
# * #each_entry(&block)
|
|
172
|
+
# * #mkdir(*args)
|
|
173
|
+
# * #opendir(*args)
|
|
174
|
+
#
|
|
175
|
+
# ### Utilities
|
|
176
|
+
#
|
|
177
|
+
# These methods are a mixture of Find, FileUtils, and others:
|
|
178
|
+
# * #find(&block)
|
|
179
|
+
# * #mkpath
|
|
180
|
+
# * #rmtree
|
|
181
|
+
# * #unlink / #delete
|
|
182
|
+
#
|
|
183
|
+
# ## Method documentation
|
|
184
|
+
#
|
|
185
|
+
# As the above section shows, most of the methods in Pathname are facades. The
|
|
186
|
+
# documentation for these methods generally just says, for instance, "See
|
|
187
|
+
# FileTest.writable?", as you should be familiar with the original method
|
|
188
|
+
# anyway, and its documentation (e.g. through `ri`) will contain more
|
|
189
|
+
# information. In some cases, a brief description will follow.
|
|
190
|
+
#
|
|
191
|
+
class Pathname
|
|
192
|
+
# <!--
|
|
193
|
+
# rdoc-file=pathname_builtin.rb
|
|
194
|
+
# - getwd()
|
|
195
|
+
# -->
|
|
196
|
+
# See `Dir.getwd`. Returns the current working directory as a Pathname.
|
|
197
|
+
#
|
|
198
|
+
def self.getwd: () -> Pathname
|
|
199
|
+
|
|
200
|
+
# <!--
|
|
201
|
+
# rdoc-file=pathname_builtin.rb
|
|
202
|
+
# - glob(*args, **kwargs) { |pathname| ... }
|
|
203
|
+
# -->
|
|
204
|
+
# See `Dir.glob`. Returns or yields Pathname objects.
|
|
205
|
+
#
|
|
206
|
+
def self.glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
|
207
|
+
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
|
208
|
+
|
|
209
|
+
# <!--
|
|
210
|
+
# rdoc-file=pathname_builtin.rb
|
|
211
|
+
# - pwd()
|
|
212
|
+
# -->
|
|
213
|
+
#
|
|
214
|
+
def self.pwd: () -> Pathname
|
|
215
|
+
|
|
216
|
+
# <!--
|
|
217
|
+
# rdoc-file=pathname_builtin.rb
|
|
218
|
+
# - +(other)
|
|
219
|
+
# -->
|
|
220
|
+
# Appends a pathname fragment to `self` to produce a new Pathname object. Since
|
|
221
|
+
# `other` is considered as a path relative to `self`, if `other` is an absolute
|
|
222
|
+
# path, the new Pathname object is created from just `other`.
|
|
223
|
+
#
|
|
224
|
+
# p1 = Pathname.new("/usr") # Pathname:/usr
|
|
225
|
+
# p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby
|
|
226
|
+
# p3 = p1 + "/etc/passwd" # Pathname:/etc/passwd
|
|
227
|
+
#
|
|
228
|
+
# # / is aliased to +.
|
|
229
|
+
# p4 = p1 / "bin/ruby" # Pathname:/usr/bin/ruby
|
|
230
|
+
# p5 = p1 / "/etc/passwd" # Pathname:/etc/passwd
|
|
231
|
+
#
|
|
232
|
+
# This method doesn't access the file system; it is pure string manipulation.
|
|
233
|
+
#
|
|
234
|
+
def +: (Pathname | String | _ToStr other) -> Pathname
|
|
235
|
+
|
|
236
|
+
# <!--
|
|
237
|
+
# rdoc-file=pathname_builtin.rb
|
|
238
|
+
# - /(other)
|
|
239
|
+
# -->
|
|
240
|
+
#
|
|
241
|
+
alias / +
|
|
242
|
+
|
|
243
|
+
# <!--
|
|
244
|
+
# rdoc-file=pathname.c
|
|
245
|
+
# - <=>(p1)
|
|
246
|
+
# -->
|
|
247
|
+
# Provides a case-sensitive comparison operator for pathnames.
|
|
248
|
+
#
|
|
249
|
+
# Pathname.new('/usr') <=> Pathname.new('/usr/bin')
|
|
250
|
+
# #=> -1
|
|
251
|
+
# Pathname.new('/usr/bin') <=> Pathname.new('/usr/bin')
|
|
252
|
+
# #=> 0
|
|
253
|
+
# Pathname.new('/usr/bin') <=> Pathname.new('/USR/BIN')
|
|
254
|
+
# #=> 1
|
|
255
|
+
#
|
|
256
|
+
# It will return `-1`, `0` or `1` depending on the value of the left argument
|
|
257
|
+
# relative to the right argument. Or it will return `nil` if the arguments are
|
|
258
|
+
# not comparable.
|
|
259
|
+
#
|
|
260
|
+
def <=>: (Pathname other) -> Integer
|
|
261
|
+
| (untyped other) -> nil
|
|
262
|
+
|
|
263
|
+
# <!--
|
|
264
|
+
# rdoc-file=pathname_builtin.rb
|
|
265
|
+
# - ==(other)
|
|
266
|
+
# -->
|
|
267
|
+
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
|
268
|
+
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
|
269
|
+
# file.
|
|
270
|
+
#
|
|
271
|
+
def ==: (untyped) -> bool
|
|
272
|
+
|
|
273
|
+
# <!--
|
|
274
|
+
# rdoc-file=pathname_builtin.rb
|
|
275
|
+
# - ===(other)
|
|
276
|
+
# -->
|
|
277
|
+
#
|
|
278
|
+
def ===: (untyped) -> bool
|
|
279
|
+
|
|
280
|
+
# <!--
|
|
281
|
+
# rdoc-file=pathname_builtin.rb
|
|
282
|
+
# - absolute?()
|
|
283
|
+
# -->
|
|
284
|
+
# Predicate method for testing whether a path is absolute.
|
|
285
|
+
#
|
|
286
|
+
# It returns `true` if the pathname begins with a slash.
|
|
287
|
+
#
|
|
288
|
+
# p = Pathname.new('/im/sure')
|
|
289
|
+
# p.absolute?
|
|
290
|
+
# #=> true
|
|
291
|
+
#
|
|
292
|
+
# p = Pathname.new('not/so/sure')
|
|
293
|
+
# p.absolute?
|
|
294
|
+
# #=> false
|
|
295
|
+
#
|
|
296
|
+
def absolute?: () -> bool
|
|
297
|
+
|
|
298
|
+
# <!--
|
|
299
|
+
# rdoc-file=pathname_builtin.rb
|
|
300
|
+
# - ascend() { |self| ... }
|
|
301
|
+
# -->
|
|
302
|
+
# Iterates over and yields a new Pathname object for each element in the given
|
|
303
|
+
# path in ascending order.
|
|
304
|
+
#
|
|
305
|
+
# Pathname.new('/path/to/some/file.rb').ascend {|v| p v}
|
|
306
|
+
# #<Pathname:/path/to/some/file.rb>
|
|
307
|
+
# #<Pathname:/path/to/some>
|
|
308
|
+
# #<Pathname:/path/to>
|
|
309
|
+
# #<Pathname:/path>
|
|
310
|
+
# #<Pathname:/>
|
|
311
|
+
#
|
|
312
|
+
# Pathname.new('path/to/some/file.rb').ascend {|v| p v}
|
|
313
|
+
# #<Pathname:path/to/some/file.rb>
|
|
314
|
+
# #<Pathname:path/to/some>
|
|
315
|
+
# #<Pathname:path/to>
|
|
316
|
+
# #<Pathname:path>
|
|
317
|
+
#
|
|
318
|
+
# Returns an Enumerator if no block was given.
|
|
319
|
+
#
|
|
320
|
+
# enum = Pathname.new("/usr/bin/ruby").ascend
|
|
321
|
+
# # ... do stuff ...
|
|
322
|
+
# enum.each { |e| ... }
|
|
323
|
+
# # yields Pathnames /usr/bin/ruby, /usr/bin, /usr, and /.
|
|
324
|
+
#
|
|
325
|
+
# It doesn't access the filesystem.
|
|
326
|
+
#
|
|
327
|
+
def ascend: () { (Pathname) -> untyped } -> nil
|
|
328
|
+
| () -> Enumerator[Pathname, nil]
|
|
329
|
+
|
|
330
|
+
# <!--
|
|
331
|
+
# rdoc-file=pathname_builtin.rb
|
|
332
|
+
# - atime()
|
|
333
|
+
# -->
|
|
334
|
+
# See `File.atime`. Returns last access time.
|
|
335
|
+
#
|
|
336
|
+
def atime: () -> Time
|
|
337
|
+
|
|
338
|
+
# <!--
|
|
339
|
+
# rdoc-file=pathname_builtin.rb
|
|
340
|
+
# - basename(...)
|
|
341
|
+
# -->
|
|
342
|
+
# See `File.basename`. Returns the last component of the path.
|
|
343
|
+
#
|
|
344
|
+
def basename: (?String | _ToStr suffix) -> Pathname
|
|
345
|
+
|
|
346
|
+
# <!--
|
|
347
|
+
# rdoc-file=pathname_builtin.rb
|
|
348
|
+
# - binread(...)
|
|
349
|
+
# -->
|
|
350
|
+
# See `File.binread`. Returns all the bytes from the file, or the first `N` if
|
|
351
|
+
# specified.
|
|
352
|
+
#
|
|
353
|
+
def binread: (?Integer length, ?Integer offset) -> String
|
|
354
|
+
|
|
355
|
+
# <!--
|
|
356
|
+
# rdoc-file=pathname_builtin.rb
|
|
357
|
+
# - binwrite(...)
|
|
358
|
+
# -->
|
|
359
|
+
# Writes `contents` to the file, opening it in binary mode.
|
|
360
|
+
#
|
|
361
|
+
# See File.binwrite.
|
|
362
|
+
#
|
|
363
|
+
def binwrite: (String, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?invalid: :replace ?, ?undef: :replace ?, ?replace: String, ?fallback: Hash[String, String] | Proc | Method, ?xml: :text | :attr, ?universal_newline: true, ?cr_newline: true, ?crlf_newline: true) -> Integer
|
|
364
|
+
|
|
365
|
+
# <!--
|
|
366
|
+
# rdoc-file=pathname_builtin.rb
|
|
367
|
+
# - birthtime()
|
|
368
|
+
# -->
|
|
369
|
+
# Returns the birth time for the file. If the platform doesn't have birthtime,
|
|
370
|
+
# raises NotImplementedError.
|
|
371
|
+
#
|
|
372
|
+
# See File.birthtime.
|
|
373
|
+
#
|
|
374
|
+
def birthtime: () -> Time
|
|
375
|
+
|
|
376
|
+
# <!--
|
|
377
|
+
# rdoc-file=pathname_builtin.rb
|
|
378
|
+
# - blockdev?()
|
|
379
|
+
# -->
|
|
380
|
+
# See `FileTest.blockdev?`.
|
|
381
|
+
#
|
|
382
|
+
def blockdev?: () -> bool
|
|
383
|
+
|
|
384
|
+
# <!--
|
|
385
|
+
# rdoc-file=pathname_builtin.rb
|
|
386
|
+
# - chardev?()
|
|
387
|
+
# -->
|
|
388
|
+
# See `FileTest.chardev?`.
|
|
389
|
+
#
|
|
390
|
+
def chardev?: () -> bool
|
|
391
|
+
|
|
392
|
+
# <!--
|
|
393
|
+
# rdoc-file=pathname_builtin.rb
|
|
394
|
+
# - children(with_directory=true)
|
|
395
|
+
# -->
|
|
396
|
+
# Returns the children of the directory (files and subdirectories, not
|
|
397
|
+
# recursive) as an array of Pathname objects.
|
|
398
|
+
#
|
|
399
|
+
# By default, the returned pathnames will have enough information to access the
|
|
400
|
+
# files. If you set `with_directory` to `false`, then the returned pathnames
|
|
401
|
+
# will contain the filename only.
|
|
402
|
+
#
|
|
403
|
+
# For example:
|
|
404
|
+
# pn = Pathname("/usr/lib/ruby/1.8")
|
|
405
|
+
# pn.children
|
|
406
|
+
# # -> [ Pathname:/usr/lib/ruby/1.8/English.rb,
|
|
407
|
+
# Pathname:/usr/lib/ruby/1.8/Env.rb,
|
|
408
|
+
# Pathname:/usr/lib/ruby/1.8/abbrev.rb, ... ]
|
|
409
|
+
# pn.children(false)
|
|
410
|
+
# # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ]
|
|
411
|
+
#
|
|
412
|
+
# Note that the results never contain the entries `.` and `..` in the directory
|
|
413
|
+
# because they are not children.
|
|
414
|
+
#
|
|
415
|
+
def children: (?boolish with_directory) -> Array[Pathname]
|
|
416
|
+
|
|
417
|
+
# <!--
|
|
418
|
+
# rdoc-file=pathname_builtin.rb
|
|
419
|
+
# - chmod(mode)
|
|
420
|
+
# -->
|
|
421
|
+
# See `File.chmod`. Changes permissions.
|
|
422
|
+
#
|
|
423
|
+
def chmod: (Integer mode_int) -> Integer
|
|
424
|
+
|
|
425
|
+
# <!--
|
|
426
|
+
# rdoc-file=pathname_builtin.rb
|
|
427
|
+
# - chown(owner, group)
|
|
428
|
+
# -->
|
|
429
|
+
# See `File.chown`. Change owner and group of file.
|
|
430
|
+
#
|
|
431
|
+
def chown: (Integer owner, Integer group) -> Integer
|
|
432
|
+
|
|
433
|
+
# <!--
|
|
434
|
+
# rdoc-file=pathname_builtin.rb
|
|
435
|
+
# - cleanpath(consider_symlink=false)
|
|
436
|
+
# -->
|
|
437
|
+
# Returns clean pathname of `self` with consecutive slashes and useless dots
|
|
438
|
+
# removed. The filesystem is not accessed.
|
|
439
|
+
#
|
|
440
|
+
# If `consider_symlink` is `true`, then a more conservative algorithm is used to
|
|
441
|
+
# avoid breaking symbolic linkages. This may retain more `..` entries than
|
|
442
|
+
# absolutely necessary, but without accessing the filesystem, this can't be
|
|
443
|
+
# avoided.
|
|
444
|
+
#
|
|
445
|
+
# See Pathname#realpath.
|
|
446
|
+
#
|
|
447
|
+
def cleanpath: (?boolish consider_symlink) -> Pathname
|
|
448
|
+
|
|
449
|
+
# <!--
|
|
450
|
+
# rdoc-file=pathname_builtin.rb
|
|
451
|
+
# - ctime()
|
|
452
|
+
# -->
|
|
453
|
+
# See `File.ctime`. Returns last (directory entry, not file) change time.
|
|
454
|
+
#
|
|
455
|
+
def ctime: () -> Time
|
|
456
|
+
|
|
457
|
+
# <!--
|
|
458
|
+
# rdoc-file=pathname_builtin.rb
|
|
459
|
+
# - delete()
|
|
460
|
+
# -->
|
|
461
|
+
#
|
|
462
|
+
def delete: () -> Integer
|
|
463
|
+
|
|
464
|
+
# <!--
|
|
465
|
+
# rdoc-file=pathname_builtin.rb
|
|
466
|
+
# - descend() { |v| ... }
|
|
467
|
+
# -->
|
|
468
|
+
# Iterates over and yields a new Pathname object for each element in the given
|
|
469
|
+
# path in descending order.
|
|
470
|
+
#
|
|
471
|
+
# Pathname.new('/path/to/some/file.rb').descend {|v| p v}
|
|
472
|
+
# #<Pathname:/>
|
|
473
|
+
# #<Pathname:/path>
|
|
474
|
+
# #<Pathname:/path/to>
|
|
475
|
+
# #<Pathname:/path/to/some>
|
|
476
|
+
# #<Pathname:/path/to/some/file.rb>
|
|
477
|
+
#
|
|
478
|
+
# Pathname.new('path/to/some/file.rb').descend {|v| p v}
|
|
479
|
+
# #<Pathname:path>
|
|
480
|
+
# #<Pathname:path/to>
|
|
481
|
+
# #<Pathname:path/to/some>
|
|
482
|
+
# #<Pathname:path/to/some/file.rb>
|
|
483
|
+
#
|
|
484
|
+
# Returns an Enumerator if no block was given.
|
|
485
|
+
#
|
|
486
|
+
# enum = Pathname.new("/usr/bin/ruby").descend
|
|
487
|
+
# # ... do stuff ...
|
|
488
|
+
# enum.each { |e| ... }
|
|
489
|
+
# # yields Pathnames /, /usr, /usr/bin, and /usr/bin/ruby.
|
|
490
|
+
#
|
|
491
|
+
# It doesn't access the filesystem.
|
|
492
|
+
#
|
|
493
|
+
def descend: () { (Pathname) -> untyped } -> nil
|
|
494
|
+
| () -> Enumerator[Pathname, nil]
|
|
495
|
+
|
|
496
|
+
# <!--
|
|
497
|
+
# rdoc-file=pathname_builtin.rb
|
|
498
|
+
# - directory?()
|
|
499
|
+
# -->
|
|
500
|
+
# See `FileTest.directory?`.
|
|
501
|
+
#
|
|
502
|
+
def directory?: () -> bool
|
|
503
|
+
|
|
504
|
+
# <!--
|
|
505
|
+
# rdoc-file=pathname_builtin.rb
|
|
506
|
+
# - dirname()
|
|
507
|
+
# -->
|
|
508
|
+
# See `File.dirname`. Returns all but the last component of the path.
|
|
509
|
+
#
|
|
510
|
+
def dirname: () -> Pathname
|
|
511
|
+
|
|
512
|
+
# <!--
|
|
513
|
+
# rdoc-file=pathname_builtin.rb
|
|
514
|
+
# - each_child(with_directory=true, &b)
|
|
515
|
+
# -->
|
|
516
|
+
# Iterates over the children of the directory (files and subdirectories, not
|
|
517
|
+
# recursive).
|
|
518
|
+
#
|
|
519
|
+
# It yields Pathname object for each child.
|
|
520
|
+
#
|
|
521
|
+
# By default, the yielded pathnames will have enough information to access the
|
|
522
|
+
# files.
|
|
523
|
+
#
|
|
524
|
+
# If you set `with_directory` to `false`, then the returned pathnames will
|
|
525
|
+
# contain the filename only.
|
|
526
|
+
#
|
|
527
|
+
# Pathname("/usr/local").each_child {|f| p f }
|
|
528
|
+
# #=> #<Pathname:/usr/local/share>
|
|
529
|
+
# # #<Pathname:/usr/local/bin>
|
|
530
|
+
# # #<Pathname:/usr/local/games>
|
|
531
|
+
# # #<Pathname:/usr/local/lib>
|
|
532
|
+
# # #<Pathname:/usr/local/include>
|
|
533
|
+
# # #<Pathname:/usr/local/sbin>
|
|
534
|
+
# # #<Pathname:/usr/local/src>
|
|
535
|
+
# # #<Pathname:/usr/local/man>
|
|
536
|
+
#
|
|
537
|
+
# Pathname("/usr/local").each_child(false) {|f| p f }
|
|
538
|
+
# #=> #<Pathname:share>
|
|
539
|
+
# # #<Pathname:bin>
|
|
540
|
+
# # #<Pathname:games>
|
|
541
|
+
# # #<Pathname:lib>
|
|
542
|
+
# # #<Pathname:include>
|
|
543
|
+
# # #<Pathname:sbin>
|
|
544
|
+
# # #<Pathname:src>
|
|
545
|
+
# # #<Pathname:man>
|
|
546
|
+
#
|
|
547
|
+
# Note that the results never contain the entries `.` and `..` in the directory
|
|
548
|
+
# because they are not children.
|
|
549
|
+
#
|
|
550
|
+
# See Pathname#children
|
|
551
|
+
#
|
|
552
|
+
def each_child: (?boolish with_directory) { (Pathname) -> void } -> Array[Pathname]
|
|
553
|
+
| (?boolish with_directory) -> Enumerator[Pathname, Array[Pathname]]
|
|
554
|
+
|
|
555
|
+
# <!--
|
|
556
|
+
# rdoc-file=pathname_builtin.rb
|
|
557
|
+
# - each_entry() { |pathname| ... }
|
|
558
|
+
# -->
|
|
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.
|
|
563
|
+
#
|
|
564
|
+
def each_entry: () { (Pathname) -> untyped } -> nil
|
|
565
|
+
|
|
566
|
+
# <!--
|
|
567
|
+
# rdoc-file=pathname_builtin.rb
|
|
568
|
+
# - each_filename() { |filename| ... }
|
|
569
|
+
# -->
|
|
570
|
+
# Iterates over each component of the path.
|
|
571
|
+
#
|
|
572
|
+
# Pathname.new("/usr/bin/ruby").each_filename {|filename| ... }
|
|
573
|
+
# # yields "usr", "bin", and "ruby".
|
|
574
|
+
#
|
|
575
|
+
# Returns an Enumerator if no block was given.
|
|
576
|
+
#
|
|
577
|
+
# enum = Pathname.new("/usr/bin/ruby").each_filename
|
|
578
|
+
# # ... do stuff ...
|
|
579
|
+
# enum.each { |e| ... }
|
|
580
|
+
# # yields "usr", "bin", and "ruby".
|
|
581
|
+
#
|
|
582
|
+
def each_filename: () { (String) -> untyped } -> nil
|
|
583
|
+
| () -> Enumerator[String, nil]
|
|
584
|
+
|
|
585
|
+
# <!--
|
|
586
|
+
# rdoc-file=pathname_builtin.rb
|
|
587
|
+
# - each_line(...) { |line| ... }
|
|
588
|
+
# -->
|
|
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.
|
|
593
|
+
#
|
|
594
|
+
def each_line: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) { (String) -> untyped } -> nil
|
|
595
|
+
| (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) { (String) -> untyped } -> nil
|
|
596
|
+
| (?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]
|
|
597
|
+
| (Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Enumerator[String, nil]
|
|
598
|
+
|
|
599
|
+
# <!--
|
|
600
|
+
# rdoc-file=pathname_builtin.rb
|
|
601
|
+
# - empty?()
|
|
602
|
+
# -->
|
|
603
|
+
# Tests the file is empty.
|
|
604
|
+
#
|
|
605
|
+
# See Dir#empty? and FileTest.empty?.
|
|
606
|
+
#
|
|
607
|
+
def empty?: () -> bool
|
|
608
|
+
|
|
609
|
+
# <!--
|
|
610
|
+
# rdoc-file=pathname_builtin.rb
|
|
611
|
+
# - entries()
|
|
612
|
+
# -->
|
|
613
|
+
# Return the entries (files and subdirectories) in the directory, each as a
|
|
614
|
+
# Pathname object.
|
|
615
|
+
#
|
|
616
|
+
def entries: () -> Array[Pathname]
|
|
617
|
+
|
|
618
|
+
# <!--
|
|
619
|
+
# rdoc-file=pathname_builtin.rb
|
|
620
|
+
# - eql?(other)
|
|
621
|
+
# -->
|
|
622
|
+
#
|
|
623
|
+
def eql?: (untyped) -> bool
|
|
624
|
+
|
|
625
|
+
# <!--
|
|
626
|
+
# rdoc-file=pathname_builtin.rb
|
|
627
|
+
# - executable?()
|
|
628
|
+
# -->
|
|
629
|
+
# See `FileTest.executable?`.
|
|
630
|
+
#
|
|
631
|
+
def executable?: () -> bool
|
|
632
|
+
|
|
633
|
+
# <!--
|
|
634
|
+
# rdoc-file=pathname_builtin.rb
|
|
635
|
+
# - executable_real?()
|
|
636
|
+
# -->
|
|
637
|
+
# See `FileTest.executable_real?`.
|
|
638
|
+
#
|
|
639
|
+
def executable_real?: () -> bool
|
|
640
|
+
|
|
641
|
+
# <!--
|
|
642
|
+
# rdoc-file=pathname_builtin.rb
|
|
643
|
+
# - exist?()
|
|
644
|
+
# -->
|
|
645
|
+
# See `FileTest.exist?`.
|
|
646
|
+
#
|
|
647
|
+
def exist?: () -> bool
|
|
648
|
+
|
|
649
|
+
# <!--
|
|
650
|
+
# rdoc-file=pathname_builtin.rb
|
|
651
|
+
# - expand_path(...)
|
|
652
|
+
# -->
|
|
653
|
+
# See `File.expand_path`.
|
|
654
|
+
#
|
|
655
|
+
def expand_path: (?String dir) -> Pathname
|
|
656
|
+
|
|
657
|
+
# <!--
|
|
658
|
+
# rdoc-file=pathname_builtin.rb
|
|
659
|
+
# - extname()
|
|
660
|
+
# -->
|
|
661
|
+
# See `File.extname`. Returns the file's extension.
|
|
662
|
+
#
|
|
663
|
+
def extname: () -> String
|
|
664
|
+
|
|
665
|
+
# <!--
|
|
666
|
+
# rdoc-file=pathname_builtin.rb
|
|
667
|
+
# - file?()
|
|
668
|
+
# -->
|
|
669
|
+
# See `FileTest.file?`.
|
|
670
|
+
#
|
|
671
|
+
def file?: () -> bool
|
|
672
|
+
|
|
673
|
+
# <!--
|
|
674
|
+
# rdoc-file=pathname_builtin.rb
|
|
675
|
+
# - fnmatch(pattern, ...)
|
|
676
|
+
# -->
|
|
677
|
+
# See `File.fnmatch`. Return `true` if the receiver matches the given pattern.
|
|
678
|
+
#
|
|
679
|
+
def fnmatch: (String pattern, ?Integer flags) -> bool
|
|
680
|
+
|
|
681
|
+
# <!--
|
|
682
|
+
# rdoc-file=pathname_builtin.rb
|
|
683
|
+
# - fnmatch?(pattern, ...)
|
|
684
|
+
# -->
|
|
685
|
+
# See `File.fnmatch?` (same as #fnmatch).
|
|
686
|
+
#
|
|
687
|
+
alias fnmatch? fnmatch
|
|
688
|
+
|
|
689
|
+
# <!--
|
|
690
|
+
# rdoc-file=pathname_builtin.rb
|
|
691
|
+
# - freeze()
|
|
692
|
+
# -->
|
|
693
|
+
# Freze self.
|
|
694
|
+
#
|
|
695
|
+
def freeze: () -> Pathname
|
|
696
|
+
|
|
697
|
+
# <!--
|
|
698
|
+
# rdoc-file=pathname_builtin.rb
|
|
699
|
+
# - ftype()
|
|
700
|
+
# -->
|
|
701
|
+
# See `File.ftype`. Returns "type" of file ("file", "directory", etc).
|
|
702
|
+
#
|
|
703
|
+
def ftype: () -> String
|
|
704
|
+
|
|
705
|
+
# <!--
|
|
706
|
+
# rdoc-file=pathname_builtin.rb
|
|
707
|
+
# - glob(*args, **kwargs) { |pathname| ... }
|
|
708
|
+
# -->
|
|
709
|
+
# Returns or yields Pathname objects.
|
|
710
|
+
#
|
|
711
|
+
# Pathname("ruby-2.4.2").glob("R*.md")
|
|
712
|
+
# #=> [#<Pathname:ruby-2.4.2/README.md>, #<Pathname:ruby-2.4.2/README.ja.md>]
|
|
713
|
+
#
|
|
714
|
+
# See Dir.glob. This method uses the `base` keyword argument of Dir.glob.
|
|
715
|
+
#
|
|
716
|
+
def glob: (String | Array[String] pattern, ?Integer flags) -> Array[Pathname]
|
|
717
|
+
| (String | Array[String] pattern, ?Integer flags) { (Pathname) -> untyped } -> nil
|
|
718
|
+
|
|
719
|
+
# <!--
|
|
720
|
+
# rdoc-file=pathname_builtin.rb
|
|
721
|
+
# - grpowned?()
|
|
722
|
+
# -->
|
|
723
|
+
# See `FileTest.grpowned?`.
|
|
724
|
+
#
|
|
725
|
+
def grpowned?: () -> bool
|
|
726
|
+
|
|
727
|
+
def hash: () -> Integer
|
|
728
|
+
|
|
729
|
+
def inspect: () -> String
|
|
730
|
+
|
|
731
|
+
# <!--
|
|
732
|
+
# rdoc-file=pathname_builtin.rb
|
|
733
|
+
# - join(*args)
|
|
734
|
+
# -->
|
|
735
|
+
# Joins the given pathnames onto `self` to create a new Pathname object. This is
|
|
736
|
+
# effectively the same as using Pathname#+ to append `self` and all arguments
|
|
737
|
+
# sequentially.
|
|
738
|
+
#
|
|
739
|
+
# path0 = Pathname.new("/usr") # Pathname:/usr
|
|
740
|
+
# path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
|
|
741
|
+
# # is the same as
|
|
742
|
+
# path1 = Pathname.new("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
|
|
743
|
+
# path0 == path1
|
|
744
|
+
# #=> true
|
|
745
|
+
#
|
|
746
|
+
def join: (*String | _ToStr | Pathname args) -> Pathname
|
|
747
|
+
|
|
748
|
+
# <!--
|
|
749
|
+
# rdoc-file=pathname_builtin.rb
|
|
750
|
+
# - lchmod(mode)
|
|
751
|
+
# -->
|
|
752
|
+
# See `File.lchmod`.
|
|
753
|
+
#
|
|
754
|
+
def lchmod: (Integer mode) -> Integer
|
|
755
|
+
|
|
756
|
+
# <!--
|
|
757
|
+
# rdoc-file=pathname_builtin.rb
|
|
758
|
+
# - lchown(owner, group)
|
|
759
|
+
# -->
|
|
760
|
+
# See `File.lchown`.
|
|
761
|
+
#
|
|
762
|
+
def lchown: (Integer owner, Integer group) -> Integer
|
|
763
|
+
|
|
764
|
+
# <!--
|
|
765
|
+
# rdoc-file=pathname_builtin.rb
|
|
766
|
+
# - lstat()
|
|
767
|
+
# -->
|
|
768
|
+
# See `File.lstat`.
|
|
769
|
+
#
|
|
770
|
+
def lstat: () -> ::File::Stat
|
|
771
|
+
|
|
772
|
+
# <!--
|
|
773
|
+
# rdoc-file=pathname_builtin.rb
|
|
774
|
+
# - lutime(atime, mtime)
|
|
775
|
+
# -->
|
|
776
|
+
# Update the access and modification times of the file.
|
|
777
|
+
#
|
|
778
|
+
# Same as Pathname#utime, but does not follow symbolic links.
|
|
779
|
+
#
|
|
780
|
+
# See File.lutime.
|
|
781
|
+
#
|
|
782
|
+
def lutime: (Time | Numeric atime, Time | Numeric mtime) -> Integer
|
|
783
|
+
|
|
784
|
+
# <!--
|
|
785
|
+
# rdoc-file=pathname_builtin.rb
|
|
786
|
+
# - make_link(old)
|
|
787
|
+
# -->
|
|
788
|
+
# See `File.link`. Creates a hard link.
|
|
789
|
+
#
|
|
790
|
+
def make_link: (String | Pathname | _ToStr old) -> Integer
|
|
791
|
+
|
|
792
|
+
# <!--
|
|
793
|
+
# rdoc-file=pathname_builtin.rb
|
|
794
|
+
# - make_symlink(old)
|
|
795
|
+
# -->
|
|
796
|
+
# See `File.symlink`. Creates a symbolic link.
|
|
797
|
+
#
|
|
798
|
+
def make_symlink: (String | Pathname | _ToStr old) -> Integer
|
|
799
|
+
|
|
800
|
+
# <!--
|
|
801
|
+
# rdoc-file=pathname_builtin.rb
|
|
802
|
+
# - mkdir(...)
|
|
803
|
+
# -->
|
|
804
|
+
# See `Dir.mkdir`. Create the referenced directory.
|
|
805
|
+
#
|
|
806
|
+
def mkdir: (?Integer perm) -> Integer
|
|
807
|
+
|
|
808
|
+
# <!--
|
|
809
|
+
# rdoc-file=pathname_builtin.rb
|
|
810
|
+
# - mkpath(mode: nil)
|
|
811
|
+
# -->
|
|
812
|
+
# Creates a full path, including any intermediate directories that don't yet
|
|
813
|
+
# exist.
|
|
814
|
+
#
|
|
815
|
+
# See FileUtils.mkpath and FileUtils.mkdir_p
|
|
816
|
+
#
|
|
817
|
+
def mkpath: () -> self
|
|
818
|
+
|
|
819
|
+
# <!--
|
|
820
|
+
# rdoc-file=pathname_builtin.rb
|
|
821
|
+
# - mountpoint?()
|
|
822
|
+
# -->
|
|
823
|
+
# Returns `true` if `self` points to a mountpoint.
|
|
824
|
+
#
|
|
825
|
+
def mountpoint?: () -> bool
|
|
826
|
+
|
|
827
|
+
# <!--
|
|
828
|
+
# rdoc-file=pathname_builtin.rb
|
|
829
|
+
# - mtime()
|
|
830
|
+
# -->
|
|
831
|
+
# See `File.mtime`. Returns last modification time.
|
|
832
|
+
#
|
|
833
|
+
def mtime: () -> Time
|
|
834
|
+
|
|
835
|
+
# <!--
|
|
836
|
+
# rdoc-file=pathname_builtin.rb
|
|
837
|
+
# - open(...) { |file| ... }
|
|
838
|
+
# -->
|
|
839
|
+
# See `File.open`. Opens the file for reading or writing.
|
|
840
|
+
#
|
|
841
|
+
def open: (?string | int mode, ?int perm) -> File
|
|
842
|
+
| [T] (?string | int mode, ?int perm) { (File) -> T } -> T
|
|
843
|
+
|
|
844
|
+
# <!--
|
|
845
|
+
# rdoc-file=pathname_builtin.rb
|
|
846
|
+
# - opendir() { |dir| ... }
|
|
847
|
+
# -->
|
|
848
|
+
# See `Dir.open`.
|
|
849
|
+
#
|
|
850
|
+
def opendir: () -> Dir
|
|
851
|
+
| [U] () { (Dir) -> U } -> U
|
|
852
|
+
|
|
853
|
+
# <!--
|
|
854
|
+
# rdoc-file=pathname_builtin.rb
|
|
855
|
+
# - owned?()
|
|
856
|
+
# -->
|
|
857
|
+
# See `FileTest.owned?`.
|
|
858
|
+
#
|
|
859
|
+
def owned?: () -> bool
|
|
860
|
+
|
|
861
|
+
# <!--
|
|
862
|
+
# rdoc-file=pathname_builtin.rb
|
|
863
|
+
# - parent()
|
|
864
|
+
# -->
|
|
865
|
+
# Returns the parent directory.
|
|
866
|
+
#
|
|
867
|
+
# This is same as `self + '..'`.
|
|
868
|
+
#
|
|
869
|
+
def parent: () -> Pathname
|
|
870
|
+
|
|
871
|
+
# <!--
|
|
872
|
+
# rdoc-file=pathname_builtin.rb
|
|
873
|
+
# - pipe?()
|
|
874
|
+
# -->
|
|
875
|
+
# See `FileTest.pipe?`.
|
|
876
|
+
#
|
|
877
|
+
def pipe?: () -> bool
|
|
878
|
+
|
|
879
|
+
# <!--
|
|
880
|
+
# rdoc-file=pathname_builtin.rb
|
|
881
|
+
# - read(...)
|
|
882
|
+
# -->
|
|
883
|
+
# See `File.read`. Returns all data from the file, or the first `N` bytes if
|
|
884
|
+
# specified.
|
|
885
|
+
#
|
|
886
|
+
def read: (?Integer length, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> String
|
|
887
|
+
|
|
888
|
+
# <!--
|
|
889
|
+
# rdoc-file=pathname_builtin.rb
|
|
890
|
+
# - readable?()
|
|
891
|
+
# -->
|
|
892
|
+
# See `FileTest.readable?`.
|
|
893
|
+
#
|
|
894
|
+
def readable?: () -> bool
|
|
895
|
+
|
|
896
|
+
# <!--
|
|
897
|
+
# rdoc-file=pathname_builtin.rb
|
|
898
|
+
# - readable_real?()
|
|
899
|
+
# -->
|
|
900
|
+
# See `FileTest.readable_real?`.
|
|
901
|
+
#
|
|
902
|
+
def readable_real?: () -> bool
|
|
903
|
+
|
|
904
|
+
# <!--
|
|
905
|
+
# rdoc-file=pathname_builtin.rb
|
|
906
|
+
# - readlines(...)
|
|
907
|
+
# -->
|
|
908
|
+
# See `File.readlines`. Returns all the lines from the file.
|
|
909
|
+
#
|
|
910
|
+
def readlines: (?String sep, ?Integer limit, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?chomp: boolish) -> Array[String]
|
|
911
|
+
| (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]
|
|
912
|
+
|
|
913
|
+
# <!--
|
|
914
|
+
# rdoc-file=pathname_builtin.rb
|
|
915
|
+
# - readlink()
|
|
916
|
+
# -->
|
|
917
|
+
# See `File.readlink`. Read symbolic link.
|
|
918
|
+
#
|
|
919
|
+
def readlink: () -> untyped
|
|
920
|
+
|
|
921
|
+
# <!--
|
|
922
|
+
# rdoc-file=pathname_builtin.rb
|
|
923
|
+
# - realdirpath(...)
|
|
924
|
+
# -->
|
|
925
|
+
# Returns the real (absolute) pathname of `self` in the actual filesystem.
|
|
926
|
+
#
|
|
927
|
+
# Does not contain symlinks or useless dots, `..` and `.`.
|
|
928
|
+
#
|
|
929
|
+
# The last component of the real pathname can be nonexistent.
|
|
930
|
+
#
|
|
931
|
+
def realdirpath: (?string | Pathname base_dir) -> Pathname
|
|
932
|
+
|
|
933
|
+
# <!--
|
|
934
|
+
# rdoc-file=pathname_builtin.rb
|
|
935
|
+
# - realpath(...)
|
|
936
|
+
# -->
|
|
937
|
+
# Returns the real (absolute) pathname for `self` in the actual filesystem.
|
|
938
|
+
#
|
|
939
|
+
# Does not contain symlinks or useless dots, `..` and `.`.
|
|
940
|
+
#
|
|
941
|
+
# All components of the pathname must exist when this method is called.
|
|
942
|
+
#
|
|
943
|
+
def realpath: (?string | Pathname base_dir) -> Pathname
|
|
944
|
+
|
|
945
|
+
# <!--
|
|
946
|
+
# rdoc-file=pathname_builtin.rb
|
|
947
|
+
# - relative?()
|
|
948
|
+
# -->
|
|
949
|
+
# The opposite of Pathname#absolute?
|
|
950
|
+
#
|
|
951
|
+
# It returns `false` if the pathname begins with a slash.
|
|
952
|
+
#
|
|
953
|
+
# p = Pathname.new('/im/sure')
|
|
954
|
+
# p.relative?
|
|
955
|
+
# #=> false
|
|
956
|
+
#
|
|
957
|
+
# p = Pathname.new('not/so/sure')
|
|
958
|
+
# p.relative?
|
|
959
|
+
# #=> true
|
|
960
|
+
#
|
|
961
|
+
def relative?: () -> bool
|
|
962
|
+
|
|
963
|
+
# <!--
|
|
964
|
+
# rdoc-file=pathname_builtin.rb
|
|
965
|
+
# - relative_path_from(base_directory)
|
|
966
|
+
# -->
|
|
967
|
+
# Returns a relative path from the given `base_directory` to the receiver.
|
|
968
|
+
#
|
|
969
|
+
# If `self` is absolute, then `base_directory` must be absolute too.
|
|
970
|
+
#
|
|
971
|
+
# If `self` is relative, then `base_directory` must be relative too.
|
|
972
|
+
#
|
|
973
|
+
# This method doesn't access the filesystem. It assumes no symlinks.
|
|
974
|
+
#
|
|
975
|
+
# ArgumentError is raised when it cannot find a relative path.
|
|
976
|
+
#
|
|
977
|
+
# Note that this method does not handle situations where the case sensitivity of
|
|
978
|
+
# the filesystem in use differs from the operating system default.
|
|
979
|
+
#
|
|
980
|
+
def relative_path_from: (Pathname | string base_directory) -> Pathname
|
|
981
|
+
|
|
982
|
+
# <!--
|
|
983
|
+
# rdoc-file=pathname_builtin.rb
|
|
984
|
+
# - rename(to)
|
|
985
|
+
# -->
|
|
986
|
+
# See `File.rename`. Rename the file.
|
|
987
|
+
#
|
|
988
|
+
def rename: (Pathname | string new_name) -> 0
|
|
989
|
+
|
|
990
|
+
# <!--
|
|
991
|
+
# rdoc-file=pathname_builtin.rb
|
|
992
|
+
# - rmdir()
|
|
993
|
+
# -->
|
|
994
|
+
# See `Dir.rmdir`. Remove the referenced directory.
|
|
995
|
+
#
|
|
996
|
+
def rmdir: () -> 0
|
|
997
|
+
|
|
998
|
+
# <!--
|
|
999
|
+
# rdoc-file=pathname_builtin.rb
|
|
1000
|
+
# - root?()
|
|
1001
|
+
# -->
|
|
1002
|
+
# Predicate method for root directories. Returns `true` if the pathname
|
|
1003
|
+
# consists of consecutive slashes.
|
|
1004
|
+
#
|
|
1005
|
+
# It doesn't access the filesystem. So it may return `false` for some pathnames
|
|
1006
|
+
# which points to roots such as `/usr/..`.
|
|
1007
|
+
#
|
|
1008
|
+
def root?: () -> bool
|
|
1009
|
+
|
|
1010
|
+
# <!--
|
|
1011
|
+
# rdoc-file=pathname_builtin.rb
|
|
1012
|
+
# - setgid?()
|
|
1013
|
+
# -->
|
|
1014
|
+
# See `FileTest.setgid?`.
|
|
1015
|
+
#
|
|
1016
|
+
def setgid?: () -> bool
|
|
1017
|
+
|
|
1018
|
+
# <!--
|
|
1019
|
+
# rdoc-file=pathname_builtin.rb
|
|
1020
|
+
# - setuid?()
|
|
1021
|
+
# -->
|
|
1022
|
+
# See `FileTest.setuid?`.
|
|
1023
|
+
#
|
|
1024
|
+
def setuid?: () -> bool
|
|
1025
|
+
|
|
1026
|
+
# <!--
|
|
1027
|
+
# rdoc-file=pathname_builtin.rb
|
|
1028
|
+
# - size()
|
|
1029
|
+
# -->
|
|
1030
|
+
# See `FileTest.size`.
|
|
1031
|
+
#
|
|
1032
|
+
def size: () -> Integer
|
|
1033
|
+
|
|
1034
|
+
# <!--
|
|
1035
|
+
# rdoc-file=pathname_builtin.rb
|
|
1036
|
+
# - size?()
|
|
1037
|
+
# -->
|
|
1038
|
+
# See `FileTest.size?`.
|
|
1039
|
+
#
|
|
1040
|
+
def size?: () -> Integer?
|
|
1041
|
+
|
|
1042
|
+
# <!--
|
|
1043
|
+
# rdoc-file=pathname_builtin.rb
|
|
1044
|
+
# - socket?()
|
|
1045
|
+
# -->
|
|
1046
|
+
# See `FileTest.socket?`.
|
|
1047
|
+
#
|
|
1048
|
+
def socket?: () -> untyped
|
|
1049
|
+
|
|
1050
|
+
# <!--
|
|
1051
|
+
# rdoc-file=pathname_builtin.rb
|
|
1052
|
+
# - split()
|
|
1053
|
+
# -->
|
|
1054
|
+
# See `File.split`. Returns the #dirname and the #basename in an Array.
|
|
1055
|
+
#
|
|
1056
|
+
def split: () -> [ Pathname, Pathname ]
|
|
1057
|
+
|
|
1058
|
+
# <!--
|
|
1059
|
+
# rdoc-file=pathname_builtin.rb
|
|
1060
|
+
# - stat()
|
|
1061
|
+
# -->
|
|
1062
|
+
# See `File.stat`. Returns a `File::Stat` object.
|
|
1063
|
+
#
|
|
1064
|
+
def stat: () -> File::Stat
|
|
1065
|
+
|
|
1066
|
+
# <!--
|
|
1067
|
+
# rdoc-file=pathname_builtin.rb
|
|
1068
|
+
# - sticky?()
|
|
1069
|
+
# -->
|
|
1070
|
+
# See `FileTest.sticky?`.
|
|
1071
|
+
#
|
|
1072
|
+
def sticky?: () -> untyped
|
|
1073
|
+
|
|
1074
|
+
# <!--
|
|
1075
|
+
# rdoc-file=pathname.c
|
|
1076
|
+
# - sub(*args)
|
|
1077
|
+
# -->
|
|
1078
|
+
# Return a pathname which is substituted by String#sub.
|
|
1079
|
+
#
|
|
1080
|
+
# path1 = Pathname.new('/usr/bin/perl')
|
|
1081
|
+
# path1.sub('perl', 'ruby')
|
|
1082
|
+
# #=> #<Pathname:/usr/bin/ruby>
|
|
1083
|
+
#
|
|
1084
|
+
def sub: (Regexp | string pattern, string | Hash[String, String] replacement) -> Pathname
|
|
1085
|
+
| (Regexp | string pattern) { (String match) -> string } -> Pathname
|
|
1086
|
+
|
|
1087
|
+
# <!--
|
|
1088
|
+
# rdoc-file=pathname_builtin.rb
|
|
1089
|
+
# - sub_ext(repl)
|
|
1090
|
+
# -->
|
|
1091
|
+
# Return a pathname with `repl` added as a suffix to the basename.
|
|
1092
|
+
#
|
|
1093
|
+
# If self has no extension part, `repl` is appended.
|
|
1094
|
+
#
|
|
1095
|
+
# Pathname.new('/usr/bin/shutdown').sub_ext('.rb')
|
|
1096
|
+
# #=> #<Pathname:/usr/bin/shutdown.rb>
|
|
1097
|
+
#
|
|
1098
|
+
def sub_ext: (string replacement) -> Pathname
|
|
1099
|
+
|
|
1100
|
+
# <!--
|
|
1101
|
+
# rdoc-file=pathname_builtin.rb
|
|
1102
|
+
# - symlink?()
|
|
1103
|
+
# -->
|
|
1104
|
+
# See `FileTest.symlink?`.
|
|
1105
|
+
#
|
|
1106
|
+
def symlink?: () -> untyped
|
|
1107
|
+
|
|
1108
|
+
# <!--
|
|
1109
|
+
# rdoc-file=pathname_builtin.rb
|
|
1110
|
+
# - sysopen(...)
|
|
1111
|
+
# -->
|
|
1112
|
+
# See `File.sysopen`.
|
|
1113
|
+
#
|
|
1114
|
+
def sysopen: (?String mode, ?Integer perm) -> Integer
|
|
1115
|
+
|
|
1116
|
+
# <!--
|
|
1117
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1118
|
+
# - pathname.taint -> obj
|
|
1119
|
+
# -->
|
|
1120
|
+
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
|
1121
|
+
#
|
|
1122
|
+
def taint: () -> Pathname
|
|
1123
|
+
|
|
1124
|
+
# <!-- rdoc-file=pathname_builtin.rb -->
|
|
1125
|
+
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
|
1126
|
+
#
|
|
1127
|
+
def to_path: () -> String
|
|
1128
|
+
|
|
1129
|
+
# <!--
|
|
1130
|
+
# rdoc-file=pathname_builtin.rb
|
|
1131
|
+
# - to_s()
|
|
1132
|
+
# -->
|
|
1133
|
+
# Return the path as a String.
|
|
1134
|
+
#
|
|
1135
|
+
alias to_s to_path
|
|
1136
|
+
|
|
1137
|
+
# <!--
|
|
1138
|
+
# rdoc-file=pathname_builtin.rb
|
|
1139
|
+
# - truncate(length)
|
|
1140
|
+
# -->
|
|
1141
|
+
# See `File.truncate`. Truncate the file to `length` bytes.
|
|
1142
|
+
#
|
|
1143
|
+
def truncate: (Integer length) -> 0
|
|
1144
|
+
|
|
1145
|
+
# <!--
|
|
1146
|
+
# rdoc-file=pathname_builtin.rb
|
|
1147
|
+
# - unlink()
|
|
1148
|
+
# -->
|
|
1149
|
+
# Removes a file or directory, using `File.unlink` or `Dir.unlink` as necessary.
|
|
1150
|
+
#
|
|
1151
|
+
def unlink: () -> Integer
|
|
1152
|
+
|
|
1153
|
+
# <!--
|
|
1154
|
+
# rdoc-file=ext/pathname/pathname.c
|
|
1155
|
+
# - pathname.untaint -> obj
|
|
1156
|
+
# -->
|
|
1157
|
+
# Returns pathname. This method is deprecated and will be removed in Ruby 3.2.
|
|
1158
|
+
#
|
|
1159
|
+
def untaint: () -> Pathname
|
|
1160
|
+
|
|
1161
|
+
# <!--
|
|
1162
|
+
# rdoc-file=pathname_builtin.rb
|
|
1163
|
+
# - utime(atime, mtime)
|
|
1164
|
+
# -->
|
|
1165
|
+
# See `File.utime`. Update the access and modification times.
|
|
1166
|
+
#
|
|
1167
|
+
def utime: (Integer | Time atime, Integer | Time mtime) -> Integer
|
|
1168
|
+
|
|
1169
|
+
# <!--
|
|
1170
|
+
# rdoc-file=pathname_builtin.rb
|
|
1171
|
+
# - world_readable?()
|
|
1172
|
+
# -->
|
|
1173
|
+
# See `FileTest.world_readable?`.
|
|
1174
|
+
#
|
|
1175
|
+
def world_readable?: () -> (Integer | nil)
|
|
1176
|
+
|
|
1177
|
+
# <!--
|
|
1178
|
+
# rdoc-file=pathname_builtin.rb
|
|
1179
|
+
# - world_writable?()
|
|
1180
|
+
# -->
|
|
1181
|
+
# See `FileTest.world_writable?`.
|
|
1182
|
+
#
|
|
1183
|
+
def world_writable?: () -> (Integer | nil)
|
|
1184
|
+
|
|
1185
|
+
# <!--
|
|
1186
|
+
# rdoc-file=pathname_builtin.rb
|
|
1187
|
+
# - writable?()
|
|
1188
|
+
# -->
|
|
1189
|
+
# See `FileTest.writable?`.
|
|
1190
|
+
#
|
|
1191
|
+
def writable?: () -> bool
|
|
1192
|
+
|
|
1193
|
+
# <!--
|
|
1194
|
+
# rdoc-file=pathname_builtin.rb
|
|
1195
|
+
# - writable_real?()
|
|
1196
|
+
# -->
|
|
1197
|
+
# See `FileTest.writable_real?`.
|
|
1198
|
+
#
|
|
1199
|
+
def writable_real?: () -> bool
|
|
1200
|
+
|
|
1201
|
+
# <!--
|
|
1202
|
+
# rdoc-file=pathname_builtin.rb
|
|
1203
|
+
# - write(...)
|
|
1204
|
+
# -->
|
|
1205
|
+
# Writes `contents` to the file. See `File.write`.
|
|
1206
|
+
#
|
|
1207
|
+
def write: (String content, ?Integer offset, ?mode: Integer | String, ?flags: Integer, ?external_encoding: encoding, ?internal_encoding: encoding, ?encoding: encoding, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish) -> Integer
|
|
1208
|
+
|
|
1209
|
+
# <!--
|
|
1210
|
+
# rdoc-file=pathname_builtin.rb
|
|
1211
|
+
# - zero?()
|
|
1212
|
+
# -->
|
|
1213
|
+
# See `FileTest.zero?`.
|
|
1214
|
+
#
|
|
1215
|
+
def zero?: () -> bool
|
|
1216
|
+
|
|
1217
|
+
private
|
|
1218
|
+
|
|
1219
|
+
def add_trailing_separator: (untyped path) -> untyped
|
|
1220
|
+
|
|
1221
|
+
def chop_basename: (untyped path) -> untyped
|
|
1222
|
+
|
|
1223
|
+
def cleanpath_aggressive: () -> untyped
|
|
1224
|
+
|
|
1225
|
+
def cleanpath_conservative: () -> untyped
|
|
1226
|
+
|
|
1227
|
+
def del_trailing_separator: (untyped path) -> untyped
|
|
1228
|
+
|
|
1229
|
+
def has_trailing_separator?: (untyped path) -> untyped
|
|
1230
|
+
|
|
1231
|
+
# <!--
|
|
1232
|
+
# rdoc-file=pathname_builtin.rb
|
|
1233
|
+
# - new(path)
|
|
1234
|
+
# -->
|
|
1235
|
+
# Create a Pathname object from the given String (or String-like object). If
|
|
1236
|
+
# `path` contains a NUL character (`\0`), an ArgumentError is raised.
|
|
1237
|
+
#
|
|
1238
|
+
def initialize: (string | Pathname) -> void
|
|
1239
|
+
|
|
1240
|
+
def plus: (untyped path1, untyped path2) -> untyped
|
|
1241
|
+
|
|
1242
|
+
def prepend_prefix: (untyped prefix, untyped relpath) -> untyped
|
|
1243
|
+
|
|
1244
|
+
def split_names: (untyped path) -> untyped
|
|
1245
|
+
|
|
1246
|
+
SAME_PATHS: Proc
|
|
1247
|
+
|
|
1248
|
+
# <!-- rdoc-file=pathname_builtin.rb -->
|
|
1249
|
+
# Separator list string.
|
|
1250
|
+
#
|
|
1251
|
+
SEPARATOR_LIST: String
|
|
1252
|
+
|
|
1253
|
+
# <!-- rdoc-file=pathname_builtin.rb -->
|
|
1254
|
+
# Regexp that matches a separator.
|
|
1255
|
+
#
|
|
1256
|
+
SEPARATOR_PAT: Regexp
|
|
1257
|
+
|
|
1258
|
+
TO_PATH: Symbol
|
|
1259
|
+
end
|
|
1260
|
+
|
|
1261
|
+
%a{annotate:rdoc:skip}
|
|
1262
|
+
module Kernel
|
|
1263
|
+
private
|
|
1264
|
+
|
|
1265
|
+
# <!--
|
|
1266
|
+
# rdoc-file=pathname_builtin.rb
|
|
1267
|
+
# - Pathname(path)
|
|
1268
|
+
# -->
|
|
1269
|
+
# Creates a Pathname object.
|
|
1270
|
+
#
|
|
1271
|
+
def self?.Pathname: (string | Pathname) -> Pathname
|
|
1272
|
+
end
|