rbs 3.10.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +7 -5
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +16 -26
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +1 -1
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +2 -2
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +19 -0
- data/CHANGELOG.md +202 -2
- data/Rakefile +9 -23
- data/Steepfile +2 -0
- data/config.yml +457 -13
- data/core/array.rbs +218 -188
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +45 -31
- data/core/complex.rbs +66 -55
- data/core/dir.rbs +57 -45
- data/core/encoding.rbs +6 -6
- data/core/enumerable.rbs +105 -91
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +24 -3
- data/core/errno.rbs +3 -2
- data/core/errors.rbs +31 -29
- data/core/exception.rbs +12 -12
- data/core/fiber.rbs +47 -36
- data/core/file.rbs +242 -169
- data/core/file_test.rbs +2 -2
- data/core/float.rbs +42 -68
- data/core/gc.rbs +78 -70
- data/core/hash.rbs +70 -60
- data/core/integer.rbs +32 -75
- data/core/io/buffer.rbs +36 -36
- data/core/io/wait.rbs +7 -7
- data/core/io.rbs +192 -146
- data/core/kernel.rbs +198 -147
- data/core/marshal.rbs +3 -3
- data/core/match_data.rbs +14 -12
- data/core/math.rbs +69 -67
- data/core/method.rbs +6 -8
- data/core/module.rbs +148 -88
- data/core/nil_class.rbs +4 -3
- data/core/numeric.rbs +53 -50
- data/core/object.rbs +6 -8
- data/core/object_space.rbs +11 -10
- data/core/pathname.rbs +131 -81
- data/core/proc.rbs +65 -34
- data/core/process.rbs +221 -201
- data/core/ractor.rbs +15 -11
- data/core/random.rbs +21 -3
- data/core/range.rbs +152 -49
- data/core/rational.rbs +5 -56
- data/core/rbs/unnamed/argf.rbs +58 -51
- data/core/rbs/unnamed/env_class.rbs +18 -13
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +7 -116
- data/core/regexp.rbs +236 -197
- data/core/ruby.rbs +1 -1
- data/core/ruby_vm.rbs +32 -30
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +1 -1
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +5 -3
- data/core/set.rbs +17 -16
- data/core/signal.rbs +2 -2
- data/core/string.rbs +318 -298
- data/core/struct.rbs +26 -25
- data/core/symbol.rbs +25 -24
- data/core/thread.rbs +40 -41
- data/core/time.rbs +47 -42
- data/core/trace_point.rbs +34 -31
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +10 -10
- data/core/warning.rbs +7 -7
- data/docs/collection.md +1 -1
- data/docs/config.md +171 -0
- data/docs/inline.md +576 -0
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +595 -98
- data/ext/rbs_extension/class_constants.c +30 -0
- data/ext/rbs_extension/class_constants.h +15 -0
- data/ext/rbs_extension/legacy_location.c +30 -53
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +125 -24
- data/include/rbs/ast.h +485 -150
- data/include/rbs/lexer.h +11 -4
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +20 -2
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs.h +8 -0
- 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 +409 -0
- data/lib/rbs/ast/ruby/comment_block.rb +245 -0
- data/lib/rbs/ast/ruby/declarations.rb +281 -0
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
- data/lib/rbs/ast/ruby/members.rb +723 -0
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +105 -20
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +62 -125
- data/lib/rbs/cli.rb +55 -23
- data/lib/rbs/collection/config/lockfile_generator.rb +8 -4
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/collection.rb +0 -1
- data/lib/rbs/definition.rb +6 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +119 -63
- data/lib/rbs/definition_builder/method_builder.rb +65 -30
- data/lib/rbs/definition_builder.rb +177 -20
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment/class_entry.rb +69 -0
- data/lib/rbs/environment/module_entry.rb +66 -0
- data/lib/rbs/environment.rb +338 -155
- data/lib/rbs/environment_loader.rb +2 -2
- data/lib/rbs/errors.rb +30 -20
- data/lib/rbs/inline_parser/comment_association.rb +117 -0
- data/lib/rbs/inline_parser.rb +542 -0
- data/lib/rbs/location_aux.rb +36 -4
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/namespace.rb +0 -7
- data/lib/rbs/parser_aux.rb +31 -8
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +10 -2
- data/lib/rbs/resolver/type_name_resolver.rb +0 -8
- data/lib/rbs/source.rb +99 -0
- data/lib/rbs/subtractor.rb +4 -3
- data/lib/rbs/test/type_check.rb +5 -2
- data/lib/rbs/type_name.rb +1 -8
- data/lib/rbs/types.rb +88 -78
- data/lib/rbs/unit_test/convertibles.rb +1 -0
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +12 -1
- data/rbs.gemspec +3 -2
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/schema/typeParam.json +17 -1
- data/sig/ancestor_builder.rbs +1 -1
- data/sig/ast/ruby/annotations.rbs +421 -0
- data/sig/ast/ruby/comment_block.rbs +127 -0
- data/sig/ast/ruby/declarations.rbs +158 -0
- data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
- data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
- data/sig/ast/ruby/members.rbs +178 -0
- data/sig/buffer.rbs +63 -5
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -0
- data/sig/definition_builder.rbs +3 -1
- data/sig/environment/class_entry.rbs +50 -0
- data/sig/environment/module_entry.rbs +50 -0
- data/sig/environment.rbs +37 -81
- data/sig/errors.rbs +26 -20
- data/sig/inline_parser/comment_association.rbs +71 -0
- data/sig/inline_parser.rbs +124 -0
- data/sig/location.rbs +32 -7
- data/sig/locator.rbs +0 -2
- data/sig/method_builder.rbs +9 -4
- data/sig/namespace.rbs +0 -5
- data/sig/parser.rbs +47 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +0 -3
- data/sig/source.rbs +48 -0
- data/sig/type_param.rbs +13 -8
- data/sig/typename.rbs +0 -5
- data/sig/types.rbs +6 -7
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +491 -143
- data/src/lexer.c +1552 -1314
- data/src/lexer.re +7 -0
- data/src/lexstate.c +8 -1
- data/src/location.c +8 -48
- data/src/parser.c +1107 -409
- data/src/util/rbs_constant_pool.c +0 -4
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
- data/stdlib/cgi-escape/0/escape.rbs +4 -4
- data/stdlib/coverage/0/coverage.rbs +4 -3
- data/stdlib/date/0/date.rbs +33 -28
- data/stdlib/date/0/date_time.rbs +24 -23
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +64 -53
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +140 -126
- data/stdlib/forwardable/0/forwardable.rbs +10 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +158 -131
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +159 -134
- data/stdlib/objspace/0/objspace.rbs +8 -30
- data/stdlib/open-uri/0/open-uri.rbs +8 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +144 -129
- data/stdlib/optparse/0/optparse.rbs +23 -14
- data/stdlib/pathname/0/pathname.rbs +2 -2
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +62 -9
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- 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/store.rbs +1 -1
- data/stdlib/ripper/0/ripper.rbs +20 -17
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/socket/0/addrinfo.rbs +9 -9
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +10 -9
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +1 -1
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +55 -54
- data/stdlib/strscan/0/string_scanner.rbs +46 -44
- data/stdlib/tempfile/0/tempfile.rbs +24 -20
- data/stdlib/time/0/time.rbs +7 -5
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +31 -18
- data/stdlib/uri/0/file.rbs +2 -2
- data/stdlib/uri/0/generic.rbs +9 -2
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +6 -6
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- metadata +66 -3
|
@@ -95,8 +95,10 @@
|
|
|
95
95
|
# paths to filesystem entries:
|
|
96
96
|
#
|
|
97
97
|
# * If the argument is a string, that value is the path.
|
|
98
|
-
# * If the argument has method
|
|
99
|
-
#
|
|
98
|
+
# * If the argument has method <code>:to_path</code>, it is converted via that
|
|
99
|
+
# method.
|
|
100
|
+
# * If the argument has method <code>:to_str</code>, it is converted via that
|
|
101
|
+
# method.
|
|
100
102
|
#
|
|
101
103
|
# ## About the Examples
|
|
102
104
|
#
|
|
@@ -132,7 +134,7 @@
|
|
|
132
134
|
# TOCTTOU, vulnerability that can exist when:
|
|
133
135
|
#
|
|
134
136
|
# * An ancestor directory of the entry at the target path is world writable;
|
|
135
|
-
# such directories include
|
|
137
|
+
# such directories include <code>/tmp</code>.
|
|
136
138
|
# * The directory tree at the target path includes:
|
|
137
139
|
#
|
|
138
140
|
# * A world-writable descendant directory.
|
|
@@ -146,14 +148,14 @@
|
|
|
146
148
|
# Also available are these methods, each of which calls
|
|
147
149
|
# FileUtils.remove_entry_secure:
|
|
148
150
|
#
|
|
149
|
-
# * FileUtils.rm_r with keyword argument
|
|
150
|
-
# * FileUtils.rm_rf with keyword argument
|
|
151
|
+
# * FileUtils.rm_r with keyword argument <code>secure: true</code>.
|
|
152
|
+
# * FileUtils.rm_rf with keyword argument <code>secure: true</code>.
|
|
151
153
|
#
|
|
152
154
|
# Finally, this method for moving entries calls FileUtils.remove_entry_secure if
|
|
153
155
|
# the source and destination are on different file systems (which means that the
|
|
154
156
|
# "move" is really a copy and remove):
|
|
155
157
|
#
|
|
156
|
-
# * FileUtils.mv with keyword argument
|
|
158
|
+
# * FileUtils.mv with keyword argument <code>secure: true</code>.
|
|
157
159
|
#
|
|
158
160
|
# Method FileUtils.remove_entry_secure removes securely by applying a special
|
|
159
161
|
# pre-process:
|
|
@@ -184,7 +186,8 @@ module FileUtils
|
|
|
184
186
|
|
|
185
187
|
type mode = Integer | String
|
|
186
188
|
|
|
187
|
-
|
|
189
|
+
%a{deprecated: Use top-level `path` instead}
|
|
190
|
+
type path = ::path
|
|
188
191
|
|
|
189
192
|
type pathlist = path | Array[path]
|
|
190
193
|
|
|
@@ -213,7 +216,7 @@ module FileUtils
|
|
|
213
216
|
#
|
|
214
217
|
# Keyword arguments:
|
|
215
218
|
#
|
|
216
|
-
# *
|
|
219
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
217
220
|
#
|
|
218
221
|
# FileUtils.cd('..')
|
|
219
222
|
# FileUtils.cd('fileutils')
|
|
@@ -248,7 +251,7 @@ module FileUtils
|
|
|
248
251
|
# -->
|
|
249
252
|
# Changes permissions on the entries at the paths given in `list` (a single path
|
|
250
253
|
# or an array of paths) to the permissions given by `mode`; returns `list` if it
|
|
251
|
-
# is an array,
|
|
254
|
+
# is an array, <code>[list]</code> otherwise:
|
|
252
255
|
#
|
|
253
256
|
# * Modifies each entry that is a regular file using
|
|
254
257
|
# [File.chmod](rdoc-ref:File.chmod).
|
|
@@ -267,30 +270,33 @@ module FileUtils
|
|
|
267
270
|
#
|
|
268
271
|
# * String `mode`: represents the permissions to be set:
|
|
269
272
|
#
|
|
270
|
-
# The string is of the form
|
|
273
|
+
# The string is of the form
|
|
274
|
+
# <code>[targets][[operator][perms[,perms]]</code>, where:
|
|
271
275
|
#
|
|
272
276
|
# * `targets` may be any combination of these letters:
|
|
273
277
|
#
|
|
274
|
-
# *
|
|
275
|
-
# *
|
|
276
|
-
# *
|
|
277
|
-
#
|
|
278
|
+
# * <code>'u'</code>: permissions apply to the file's owner.
|
|
279
|
+
# * <code>'g'</code>: permissions apply to users in the file's group.
|
|
280
|
+
# * <code>'o'</code>: permissions apply to other users not in the
|
|
281
|
+
# file's group.
|
|
282
|
+
# * <code>'a'</code> (the default): permissions apply to all users.
|
|
278
283
|
#
|
|
279
284
|
# * `operator` may be one of these letters:
|
|
280
285
|
#
|
|
281
|
-
# *
|
|
282
|
-
# *
|
|
283
|
-
# *
|
|
286
|
+
# * <code>'+'</code>: adds permissions.
|
|
287
|
+
# * <code>'-'</code>: removes permissions.
|
|
288
|
+
# * <code>'='</code>: sets (replaces) permissions.
|
|
284
289
|
#
|
|
285
290
|
# * `perms` (may be repeated, with separating commas) may be any
|
|
286
291
|
# combination of these letters:
|
|
287
292
|
#
|
|
288
|
-
# *
|
|
289
|
-
# *
|
|
290
|
-
# *
|
|
291
|
-
# *
|
|
292
|
-
#
|
|
293
|
-
# *
|
|
293
|
+
# * <code>'r'</code>: Read.
|
|
294
|
+
# * <code>'w'</code>: Write.
|
|
295
|
+
# * <code>'x'</code>: Execute (search, for a directory).
|
|
296
|
+
# * <code>'X'</code>: Search (for a directories only; must be used
|
|
297
|
+
# with <code>'+'</code>)
|
|
298
|
+
# * <code>'s'</code>: Uid or gid.
|
|
299
|
+
# * <code>'t'</code>: Sticky bit.
|
|
294
300
|
#
|
|
295
301
|
# Examples:
|
|
296
302
|
#
|
|
@@ -299,8 +305,8 @@ module FileUtils
|
|
|
299
305
|
#
|
|
300
306
|
# Keyword arguments:
|
|
301
307
|
#
|
|
302
|
-
# *
|
|
303
|
-
# *
|
|
308
|
+
# * <code>noop: true</code> - does not change permissions; returns `nil`.
|
|
309
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
304
310
|
#
|
|
305
311
|
# FileUtils.chmod(0755, 'src0.txt', noop: true, verbose: true)
|
|
306
312
|
# FileUtils.chmod(0644, ['src0.txt', 'src0.dat'], noop: true, verbose: true)
|
|
@@ -332,7 +338,7 @@ module FileUtils
|
|
|
332
338
|
# -->
|
|
333
339
|
# Changes the owner and group on the entries at the paths given in `list` (a
|
|
334
340
|
# single path or an array of paths) to the given `user` and `group`; returns
|
|
335
|
-
# `list` if it is an array,
|
|
341
|
+
# `list` if it is an array, <code>[list]</code> otherwise:
|
|
336
342
|
#
|
|
337
343
|
# * Modifies each entry that is a regular file using
|
|
338
344
|
# [File.chown](rdoc-ref:File.chown).
|
|
@@ -344,10 +350,10 @@ module FileUtils
|
|
|
344
350
|
#
|
|
345
351
|
# User and group:
|
|
346
352
|
#
|
|
347
|
-
# * Argument `user` may be a user name or a user id; if `nil` or
|
|
348
|
-
# user is not changed.
|
|
349
|
-
# * Argument `group` may be a group name or a group id; if `nil` or
|
|
350
|
-
# group is not changed.
|
|
353
|
+
# * Argument `user` may be a user name or a user id; if `nil` or
|
|
354
|
+
# <code>-1</code>, the user is not changed.
|
|
355
|
+
# * Argument `group` may be a group name or a group id; if `nil` or
|
|
356
|
+
# <code>-1</code>, the group is not changed.
|
|
351
357
|
# * The user must be a member of the group.
|
|
352
358
|
#
|
|
353
359
|
# Examples:
|
|
@@ -373,8 +379,8 @@ module FileUtils
|
|
|
373
379
|
#
|
|
374
380
|
# Keyword arguments:
|
|
375
381
|
#
|
|
376
|
-
# *
|
|
377
|
-
# *
|
|
382
|
+
# * <code>noop: true</code> - does not change permissions; returns `nil`.
|
|
383
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
378
384
|
#
|
|
379
385
|
# FileUtils.chown('user2', 'group1', 'src0.txt', noop: true, verbose: true)
|
|
380
386
|
# FileUtils.chown(1004, 1004, 'src0.txt', noop: true, verbose: true)
|
|
@@ -590,7 +596,7 @@ module FileUtils
|
|
|
590
596
|
# File.file?('dest0.txt') # => true
|
|
591
597
|
#
|
|
592
598
|
# If `src` is the path to a file and `dest` is the path to a directory, copies
|
|
593
|
-
# `src` to
|
|
599
|
+
# `src` to <code>dest/src</code>:
|
|
594
600
|
#
|
|
595
601
|
# FileUtils.touch('src1.txt')
|
|
596
602
|
# FileUtils.mkdir('dest1')
|
|
@@ -609,9 +615,9 @@ module FileUtils
|
|
|
609
615
|
#
|
|
610
616
|
# Keyword arguments:
|
|
611
617
|
#
|
|
612
|
-
# *
|
|
613
|
-
# *
|
|
614
|
-
# *
|
|
618
|
+
# * <code>preserve: true</code> - preserves file times.
|
|
619
|
+
# * <code>noop: true</code> - does not copy files.
|
|
620
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
615
621
|
#
|
|
616
622
|
# FileUtils.cp('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
617
623
|
# FileUtils.cp('src1.txt', 'dest1', noop: true, verbose: true)
|
|
@@ -674,8 +680,8 @@ module FileUtils
|
|
|
674
680
|
# # |-- src2.txt
|
|
675
681
|
# # `-- src3.txt
|
|
676
682
|
#
|
|
677
|
-
# If `src` and `dest` are both paths to directories, creates links
|
|
678
|
-
# and descendents pointing to `src` and its descendents:
|
|
683
|
+
# If `src` and `dest` are both paths to directories, creates links
|
|
684
|
+
# <code>dest/src</code> and descendents pointing to `src` and its descendents:
|
|
679
685
|
#
|
|
680
686
|
# tree('src1')
|
|
681
687
|
# # => src1
|
|
@@ -699,7 +705,7 @@ module FileUtils
|
|
|
699
705
|
#
|
|
700
706
|
# If `src` is an array of paths to entries and `dest` is the path to a
|
|
701
707
|
# directory, for each path `filepath` in `src`, creates a link at
|
|
702
|
-
#
|
|
708
|
+
# <code>dest/filepath</code> pointing to that path:
|
|
703
709
|
#
|
|
704
710
|
# tree('src2')
|
|
705
711
|
# # => src2
|
|
@@ -722,11 +728,12 @@ module FileUtils
|
|
|
722
728
|
#
|
|
723
729
|
# Keyword arguments:
|
|
724
730
|
#
|
|
725
|
-
# *
|
|
726
|
-
# dereference it.
|
|
727
|
-
# *
|
|
728
|
-
# *
|
|
729
|
-
#
|
|
731
|
+
# * <code>dereference_root: false</code> - if `src` is a symbolic link, does
|
|
732
|
+
# not dereference it.
|
|
733
|
+
# * <code>noop: true</code> - does not create links.
|
|
734
|
+
# * <code>remove_destination: true</code> - removes `dest` before creating
|
|
735
|
+
# links.
|
|
736
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
730
737
|
#
|
|
731
738
|
# FileUtils.cp_lr('src0', 'dest0', noop: true, verbose: true)
|
|
732
739
|
# FileUtils.cp_lr('src1', 'dest1', noop: true, verbose: true)
|
|
@@ -739,7 +746,7 @@ module FileUtils
|
|
|
739
746
|
# cp -lr src2/sub0 src2/sub1 dest2
|
|
740
747
|
#
|
|
741
748
|
# Raises an exception if `dest` is the path to an existing file or directory and
|
|
742
|
-
# keyword argument
|
|
749
|
+
# keyword argument <code>remove_destination: true</code> is not given.
|
|
743
750
|
#
|
|
744
751
|
# Related: [methods for copying](rdoc-ref:FileUtils@Copying).
|
|
745
752
|
#
|
|
@@ -766,7 +773,7 @@ module FileUtils
|
|
|
766
773
|
# File.file?('dest0.txt') # => true
|
|
767
774
|
#
|
|
768
775
|
# If `src` is the path to a file and `dest` is the path to a directory, copies
|
|
769
|
-
# `src` to
|
|
776
|
+
# `src` to <code>dest/src</code>:
|
|
770
777
|
#
|
|
771
778
|
# FileUtils.touch('src1.txt')
|
|
772
779
|
# FileUtils.mkdir('dest1')
|
|
@@ -796,7 +803,7 @@ module FileUtils
|
|
|
796
803
|
# # `-- src3.txt
|
|
797
804
|
#
|
|
798
805
|
# If `src` and `dest` are paths to directories, recursively copies `src` to
|
|
799
|
-
#
|
|
806
|
+
# <code>dest/src</code>:
|
|
800
807
|
#
|
|
801
808
|
# tree('src3')
|
|
802
809
|
# # => src3
|
|
@@ -824,12 +831,13 @@ module FileUtils
|
|
|
824
831
|
#
|
|
825
832
|
# Keyword arguments:
|
|
826
833
|
#
|
|
827
|
-
# *
|
|
828
|
-
# dereference it.
|
|
829
|
-
# *
|
|
830
|
-
# *
|
|
831
|
-
# *
|
|
832
|
-
#
|
|
834
|
+
# * <code>dereference_root: false</code> - if `src` is a symbolic link, does
|
|
835
|
+
# not dereference it.
|
|
836
|
+
# * <code>noop: true</code> - does not copy files.
|
|
837
|
+
# * <code>preserve: true</code> - preserves file times.
|
|
838
|
+
# * <code>remove_destination: true</code> - removes `dest` before copying
|
|
839
|
+
# files.
|
|
840
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
833
841
|
#
|
|
834
842
|
# FileUtils.cp_r('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
835
843
|
# FileUtils.cp_r('src1.txt', 'dest1', noop: true, verbose: true)
|
|
@@ -886,8 +894,8 @@ module FileUtils
|
|
|
886
894
|
# FileUtils.install('src1.txt', 'dest1.txt')
|
|
887
895
|
# File.read('dest1.txt') # => "aaa\n"
|
|
888
896
|
#
|
|
889
|
-
# If `dest` is a directory entry, copies from `src` to
|
|
890
|
-
# if necessary:
|
|
897
|
+
# If `dest` is a directory entry, copies from `src` to <code>dest/src</code>,
|
|
898
|
+
# overwriting if necessary:
|
|
891
899
|
#
|
|
892
900
|
# File.read('src2.txt') # => "aaa\n"
|
|
893
901
|
# File.read('dest2/src2.txt') # => "bbb\n"
|
|
@@ -895,7 +903,7 @@ module FileUtils
|
|
|
895
903
|
# File.read('dest2/src2.txt') # => "aaa\n"
|
|
896
904
|
#
|
|
897
905
|
# If `src` is an array of paths and `dest` points to a directory, copies each
|
|
898
|
-
# path `path` in `src` to
|
|
906
|
+
# path `path` in `src` to <code>dest/path</code>:
|
|
899
907
|
#
|
|
900
908
|
# File.file?('src3.txt') # => true
|
|
901
909
|
# File.file?('src3.dat') # => true
|
|
@@ -906,16 +914,16 @@ module FileUtils
|
|
|
906
914
|
#
|
|
907
915
|
# Keyword arguments:
|
|
908
916
|
#
|
|
909
|
-
# *
|
|
917
|
+
# * <code>group: <i>group</i></code> - changes the group if not `nil`, using
|
|
910
918
|
# [File.chown](rdoc-ref:File.chown).
|
|
911
|
-
# *
|
|
919
|
+
# * <code>mode: <i>permissions</i></code> - changes the permissions. using
|
|
912
920
|
# [File.chmod](rdoc-ref:File.chmod).
|
|
913
|
-
# *
|
|
914
|
-
# *
|
|
921
|
+
# * <code>noop: true</code> - does not copy entries; returns `nil`.
|
|
922
|
+
# * <code>owner: <i>owner</i></code> - changes the owner if not `nil`, using
|
|
915
923
|
# [File.chown](rdoc-ref:File.chown).
|
|
916
|
-
# *
|
|
924
|
+
# * <code>preserve: true</code> - preserve timestamps using
|
|
917
925
|
# [File.utime](rdoc-ref:File.utime).
|
|
918
|
-
# *
|
|
926
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
919
927
|
#
|
|
920
928
|
# FileUtils.install('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
921
929
|
# FileUtils.install('src1.txt', 'dest1.txt', noop: true, verbose: true)
|
|
@@ -999,8 +1007,8 @@ module FileUtils
|
|
|
999
1007
|
# Dir.children('tmp1/') # => ["t.lnk"]
|
|
1000
1008
|
#
|
|
1001
1009
|
# When `src` is the path to an existing file and `dest` is the path to an
|
|
1002
|
-
# existing directory, creates a hard link at
|
|
1003
|
-
# returns zero:
|
|
1010
|
+
# existing directory, creates a hard link at <code>dest/src</code> pointing to
|
|
1011
|
+
# `src`; returns zero:
|
|
1004
1012
|
#
|
|
1005
1013
|
# Dir.children('tmp2') # => ["t.dat"]
|
|
1006
1014
|
# Dir.children('tmp3') # => []
|
|
@@ -1009,7 +1017,7 @@ module FileUtils
|
|
|
1009
1017
|
#
|
|
1010
1018
|
# When `src` is an array of paths to existing files and `dest` is the path to an
|
|
1011
1019
|
# existing directory, then for each path `target` in `src`, creates a hard link
|
|
1012
|
-
# at
|
|
1020
|
+
# at <code>dest/target</code> pointing to `target`; returns `src`:
|
|
1013
1021
|
#
|
|
1014
1022
|
# Dir.children('tmp4/') # => []
|
|
1015
1023
|
# FileUtils.ln(['tmp0/t.txt', 'tmp2/t.dat'], 'tmp4/') # => ["tmp0/t.txt", "tmp2/t.dat"]
|
|
@@ -1017,9 +1025,9 @@ module FileUtils
|
|
|
1017
1025
|
#
|
|
1018
1026
|
# Keyword arguments:
|
|
1019
1027
|
#
|
|
1020
|
-
# *
|
|
1021
|
-
# *
|
|
1022
|
-
# *
|
|
1028
|
+
# * <code>force: true</code> - overwrites `dest` if it exists.
|
|
1029
|
+
# * <code>noop: true</code> - does not create links.
|
|
1030
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1023
1031
|
#
|
|
1024
1032
|
# FileUtils.ln('tmp0/t.txt', 'tmp1/t.lnk', verbose: true)
|
|
1025
1033
|
# FileUtils.ln('tmp2/t.dat', 'tmp3', verbose: true)
|
|
@@ -1072,8 +1080,8 @@ module FileUtils
|
|
|
1072
1080
|
# File.symlink?('dest0.txt') # => true
|
|
1073
1081
|
#
|
|
1074
1082
|
# * When `dest` is the path to an existing file, creates a symbolic link at
|
|
1075
|
-
# `dest` pointing to `src` if and only if keyword argument
|
|
1076
|
-
# given (raises an exception otherwise):
|
|
1083
|
+
# `dest` pointing to `src` if and only if keyword argument <code>force:
|
|
1084
|
+
# true</code> is given (raises an exception otherwise):
|
|
1077
1085
|
#
|
|
1078
1086
|
# FileUtils.touch('src1.txt')
|
|
1079
1087
|
# FileUtils.touch('dest1.txt')
|
|
@@ -1082,8 +1090,8 @@ module FileUtils
|
|
|
1082
1090
|
#
|
|
1083
1091
|
# FileUtils.ln_s('src1.txt', 'dest1.txt') # Raises Errno::EEXIST.
|
|
1084
1092
|
#
|
|
1085
|
-
# If `dest` is the path to a directory, creates a symbolic link at
|
|
1086
|
-
# pointing to `src`:
|
|
1093
|
+
# If `dest` is the path to a directory, creates a symbolic link at
|
|
1094
|
+
# <code>dest/src</code> pointing to `src`:
|
|
1087
1095
|
#
|
|
1088
1096
|
# FileUtils.touch('src2.txt')
|
|
1089
1097
|
# FileUtils.mkdir('destdir2')
|
|
@@ -1091,8 +1099,8 @@ module FileUtils
|
|
|
1091
1099
|
# File.symlink?('destdir2/src2.txt') # => true
|
|
1092
1100
|
#
|
|
1093
1101
|
# If `src` is an array of paths to existing files and `dest` is a directory, for
|
|
1094
|
-
# each child `child` in `src` creates a symbolic link
|
|
1095
|
-
# `child`:
|
|
1102
|
+
# each child `child` in `src` creates a symbolic link <code>dest/child</code>
|
|
1103
|
+
# pointing to `child`:
|
|
1096
1104
|
#
|
|
1097
1105
|
# FileUtils.mkdir('srcdir3')
|
|
1098
1106
|
# FileUtils.touch('srcdir3/src0.txt')
|
|
@@ -1104,10 +1112,10 @@ module FileUtils
|
|
|
1104
1112
|
#
|
|
1105
1113
|
# Keyword arguments:
|
|
1106
1114
|
#
|
|
1107
|
-
# *
|
|
1108
|
-
# *
|
|
1109
|
-
# *
|
|
1110
|
-
# *
|
|
1115
|
+
# * <code>force: true</code> - overwrites `dest` if it exists.
|
|
1116
|
+
# * <code>relative: false</code> - create links relative to `dest`.
|
|
1117
|
+
# * <code>noop: true</code> - does not create links.
|
|
1118
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1111
1119
|
#
|
|
1112
1120
|
# FileUtils.ln_s('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
1113
1121
|
# FileUtils.ln_s('src1.txt', 'destdir1', noop: true, verbose: true)
|
|
@@ -1143,7 +1151,8 @@ module FileUtils
|
|
|
1143
1151
|
# rdoc-file=lib/fileutils.rb
|
|
1144
1152
|
# - ln_sf(src, dest, noop: nil, verbose: nil)
|
|
1145
1153
|
# -->
|
|
1146
|
-
# Like FileUtils.ln_s, but always with keyword argument
|
|
1154
|
+
# Like FileUtils.ln_s, but always with keyword argument <code>force: true</code>
|
|
1155
|
+
# given.
|
|
1147
1156
|
#
|
|
1148
1157
|
def self?.ln_sf: (pathlist src, path dest, ?noop: boolish, ?verbose: boolish) -> void
|
|
1149
1158
|
|
|
@@ -1160,23 +1169,25 @@ module FileUtils
|
|
|
1160
1169
|
# - mkdir(list, mode: nil, noop: nil, verbose: nil)
|
|
1161
1170
|
# -->
|
|
1162
1171
|
# Creates directories at the paths in the given `list` (a single path or an
|
|
1163
|
-
# array of paths); returns `list` if it is an array,
|
|
1172
|
+
# array of paths); returns `list` if it is an array, <code>[list]</code>
|
|
1173
|
+
# otherwise.
|
|
1164
1174
|
#
|
|
1165
1175
|
# Argument `list` or its elements should be [interpretable as
|
|
1166
1176
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1167
1177
|
#
|
|
1168
1178
|
# With no keyword arguments, creates a directory at each `path` in `list` by
|
|
1169
|
-
# calling:
|
|
1179
|
+
# calling: <code>Dir.mkdir(path, mode)</code>; see
|
|
1180
|
+
# [Dir.mkdir](rdoc-ref:Dir.mkdir):
|
|
1170
1181
|
#
|
|
1171
1182
|
# FileUtils.mkdir(%w[tmp0 tmp1]) # => ["tmp0", "tmp1"]
|
|
1172
1183
|
# FileUtils.mkdir('tmp4') # => ["tmp4"]
|
|
1173
1184
|
#
|
|
1174
1185
|
# Keyword arguments:
|
|
1175
1186
|
#
|
|
1176
|
-
# *
|
|
1177
|
-
# [File.chmod](rdoc-ref:File.chmod).
|
|
1178
|
-
# *
|
|
1179
|
-
# *
|
|
1187
|
+
# * <code>mode: <i>mode</i></code> - also calls <code>File.chmod(mode,
|
|
1188
|
+
# path)</code>; see [File.chmod](rdoc-ref:File.chmod).
|
|
1189
|
+
# * <code>noop: true</code> - does not create directories.
|
|
1190
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1180
1191
|
#
|
|
1181
1192
|
# FileUtils.mkdir(%w[tmp0 tmp1], verbose: true)
|
|
1182
1193
|
# FileUtils.mkdir(%w[tmp2 tmp3], mode: 0700, verbose: true)
|
|
@@ -1199,24 +1210,24 @@ module FileUtils
|
|
|
1199
1210
|
# -->
|
|
1200
1211
|
# Creates directories at the paths in the given `list` (a single path or an
|
|
1201
1212
|
# array of paths), also creating ancestor directories as needed; returns `list`
|
|
1202
|
-
# if it is an array,
|
|
1213
|
+
# if it is an array, <code>[list]</code> otherwise.
|
|
1203
1214
|
#
|
|
1204
1215
|
# Argument `list` or its elements should be [interpretable as
|
|
1205
1216
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1206
1217
|
#
|
|
1207
1218
|
# With no keyword arguments, creates a directory at each `path` in `list`, along
|
|
1208
|
-
# with any needed ancestor directories, by calling:
|
|
1209
|
-
# [Dir.mkdir](rdoc-ref:Dir.mkdir):
|
|
1219
|
+
# with any needed ancestor directories, by calling: <code>Dir.mkdir(path,
|
|
1220
|
+
# mode)</code>; see [Dir.mkdir](rdoc-ref:Dir.mkdir):
|
|
1210
1221
|
#
|
|
1211
1222
|
# FileUtils.mkdir_p(%w[tmp0/tmp1 tmp2/tmp3]) # => ["tmp0/tmp1", "tmp2/tmp3"]
|
|
1212
1223
|
# FileUtils.mkdir_p('tmp4/tmp5') # => ["tmp4/tmp5"]
|
|
1213
1224
|
#
|
|
1214
1225
|
# Keyword arguments:
|
|
1215
1226
|
#
|
|
1216
|
-
# *
|
|
1217
|
-
# [File.chmod](rdoc-ref:File.chmod).
|
|
1218
|
-
# *
|
|
1219
|
-
# *
|
|
1227
|
+
# * <code>mode: <i>mode</i></code> - also calls <code>File.chmod(mode,
|
|
1228
|
+
# path)</code>; see [File.chmod](rdoc-ref:File.chmod).
|
|
1229
|
+
# * <code>noop: true</code> - does not create directories.
|
|
1230
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1220
1231
|
#
|
|
1221
1232
|
# FileUtils.mkdir_p(%w[tmp0 tmp1], verbose: true)
|
|
1222
1233
|
# FileUtils.mkdir_p(%w[tmp2 tmp3], mode: 0700, verbose: true)
|
|
@@ -1274,8 +1285,8 @@ module FileUtils
|
|
|
1274
1285
|
# If `src` and `dest` are on different file systems, first copies, then removes
|
|
1275
1286
|
# `src`.
|
|
1276
1287
|
#
|
|
1277
|
-
# May cause a local vulnerability if not called with keyword argument
|
|
1278
|
-
# true
|
|
1288
|
+
# May cause a local vulnerability if not called with keyword argument
|
|
1289
|
+
# <code>secure: true</code>; see [Avoiding the TOCTTOU
|
|
1279
1290
|
# Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
|
|
1280
1291
|
#
|
|
1281
1292
|
# If `src` is the path to a single file or directory and `dest` does not exist,
|
|
@@ -1312,13 +1323,13 @@ module FileUtils
|
|
|
1312
1323
|
#
|
|
1313
1324
|
# Keyword arguments:
|
|
1314
1325
|
#
|
|
1315
|
-
# *
|
|
1316
|
-
# `dest` are on different file systems), ignores raised
|
|
1317
|
-
# StandardError and its descendants.
|
|
1318
|
-
# *
|
|
1319
|
-
# *
|
|
1326
|
+
# * <code>force: true</code> - if the move includes removing `src` (that is,
|
|
1327
|
+
# if `src` and `dest` are on different file systems), ignores raised
|
|
1328
|
+
# exceptions of StandardError and its descendants.
|
|
1329
|
+
# * <code>noop: true</code> - does not move files.
|
|
1330
|
+
# * <code>secure: true</code> - removes `src` securely; see details at
|
|
1320
1331
|
# FileUtils.remove_entry_secure.
|
|
1321
|
-
# *
|
|
1332
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1322
1333
|
#
|
|
1323
1334
|
# FileUtils.mv('src0', 'dest0', noop: true, verbose: true)
|
|
1324
1335
|
# FileUtils.mv(['src1.txt', 'src1'], 'dest1', noop: true, verbose: true)
|
|
@@ -1469,7 +1480,7 @@ module FileUtils
|
|
|
1469
1480
|
# - rm(list, force: nil, noop: nil, verbose: nil)
|
|
1470
1481
|
# -->
|
|
1471
1482
|
# Removes entries at the paths in the given `list` (a single path or an array of
|
|
1472
|
-
# paths) returns `list`, if it is an array,
|
|
1483
|
+
# paths) returns `list`, if it is an array, <code>[list]</code> otherwise.
|
|
1473
1484
|
#
|
|
1474
1485
|
# Argument `list` or its elements should be [interpretable as
|
|
1475
1486
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
@@ -1481,10 +1492,10 @@ module FileUtils
|
|
|
1481
1492
|
#
|
|
1482
1493
|
# Keyword arguments:
|
|
1483
1494
|
#
|
|
1484
|
-
# *
|
|
1485
|
-
# descendants.
|
|
1486
|
-
# *
|
|
1487
|
-
# *
|
|
1495
|
+
# * <code>force: true</code> - ignores raised exceptions of StandardError and
|
|
1496
|
+
# its descendants.
|
|
1497
|
+
# * <code>noop: true</code> - does not remove files; returns `nil`.
|
|
1498
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1488
1499
|
#
|
|
1489
1500
|
# FileUtils.rm(['src0.dat', 'src0.txt'], noop: true, verbose: true)
|
|
1490
1501
|
#
|
|
@@ -1546,13 +1557,13 @@ module FileUtils
|
|
|
1546
1557
|
# - rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
|
|
1547
1558
|
# -->
|
|
1548
1559
|
# Removes entries at the paths in the given `list` (a single path or an array of
|
|
1549
|
-
# paths); returns `list`, if it is an array,
|
|
1560
|
+
# paths); returns `list`, if it is an array, <code>[list]</code> otherwise.
|
|
1550
1561
|
#
|
|
1551
1562
|
# Argument `list` or its elements should be [interpretable as
|
|
1552
1563
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1553
1564
|
#
|
|
1554
|
-
# May cause a local vulnerability if not called with keyword argument
|
|
1555
|
-
# true
|
|
1565
|
+
# May cause a local vulnerability if not called with keyword argument
|
|
1566
|
+
# <code>secure: true</code>; see [Avoiding the TOCTTOU
|
|
1556
1567
|
# Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
|
|
1557
1568
|
#
|
|
1558
1569
|
# For each file path, removes the file at that path:
|
|
@@ -1577,12 +1588,12 @@ module FileUtils
|
|
|
1577
1588
|
#
|
|
1578
1589
|
# Keyword arguments:
|
|
1579
1590
|
#
|
|
1580
|
-
# *
|
|
1581
|
-
# descendants.
|
|
1582
|
-
# *
|
|
1583
|
-
# *
|
|
1591
|
+
# * <code>force: true</code> - ignores raised exceptions of StandardError and
|
|
1592
|
+
# its descendants.
|
|
1593
|
+
# * <code>noop: true</code> - does not remove entries; returns `nil`.
|
|
1594
|
+
# * <code>secure: true</code> - removes `src` securely; see details at
|
|
1584
1595
|
# FileUtils.remove_entry_secure.
|
|
1585
|
-
# *
|
|
1596
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1586
1597
|
#
|
|
1587
1598
|
# FileUtils.rm_r(['src0.dat', 'src0.txt'], noop: true, verbose: true)
|
|
1588
1599
|
# FileUtils.rm_r('src1', noop: true, verbose: true)
|
|
@@ -1607,8 +1618,8 @@ module FileUtils
|
|
|
1607
1618
|
# Argument `list` or its elements should be [interpretable as
|
|
1608
1619
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1609
1620
|
#
|
|
1610
|
-
# May cause a local vulnerability if not called with keyword argument
|
|
1611
|
-
# true
|
|
1621
|
+
# May cause a local vulnerability if not called with keyword argument
|
|
1622
|
+
# <code>secure: true</code>; see [Avoiding the TOCTTOU
|
|
1612
1623
|
# Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
|
|
1613
1624
|
#
|
|
1614
1625
|
# See FileUtils.rm_r for keyword arguments.
|
|
@@ -1636,22 +1647,24 @@ module FileUtils
|
|
|
1636
1647
|
# - rmdir(list, parents: nil, noop: nil, verbose: nil)
|
|
1637
1648
|
# -->
|
|
1638
1649
|
# Removes directories at the paths in the given `list` (a single path or an
|
|
1639
|
-
# array of paths); returns `list`, if it is an array,
|
|
1650
|
+
# array of paths); returns `list`, if it is an array, <code>[list]</code>
|
|
1651
|
+
# otherwise.
|
|
1640
1652
|
#
|
|
1641
1653
|
# Argument `list` or its elements should be [interpretable as
|
|
1642
1654
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1643
1655
|
#
|
|
1644
1656
|
# With no keyword arguments, removes the directory at each `path` in `list`, by
|
|
1645
|
-
# calling:
|
|
1657
|
+
# calling: <code>Dir.rmdir(path)</code>; see [Dir.rmdir](rdoc-ref:Dir.rmdir):
|
|
1646
1658
|
#
|
|
1647
1659
|
# FileUtils.rmdir(%w[tmp0/tmp1 tmp2/tmp3]) # => ["tmp0/tmp1", "tmp2/tmp3"]
|
|
1648
1660
|
# FileUtils.rmdir('tmp4/tmp5') # => ["tmp4/tmp5"]
|
|
1649
1661
|
#
|
|
1650
1662
|
# Keyword arguments:
|
|
1651
1663
|
#
|
|
1652
|
-
# *
|
|
1653
|
-
#
|
|
1654
|
-
# *
|
|
1664
|
+
# * <code>parents: true</code> - removes successive ancestor directories if
|
|
1665
|
+
# empty.
|
|
1666
|
+
# * <code>noop: true</code> - does not remove directories.
|
|
1667
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1655
1668
|
#
|
|
1656
1669
|
# FileUtils.rmdir(%w[tmp0/tmp1 tmp2/tmp3], parents: true, verbose: true)
|
|
1657
1670
|
# FileUtils.rmdir('tmp4/tmp5', parents: true, verbose: true)
|
|
@@ -1674,7 +1687,7 @@ module FileUtils
|
|
|
1674
1687
|
# -->
|
|
1675
1688
|
# Updates modification times (mtime) and access times (atime) of the entries
|
|
1676
1689
|
# given by the paths in `list` (a single path or an array of paths); returns
|
|
1677
|
-
# `list` if it is an array,
|
|
1690
|
+
# `list` if it is an array, <code>[list]</code> otherwise.
|
|
1678
1691
|
#
|
|
1679
1692
|
# By default, creates an empty file for any path to a non-existent entry; use
|
|
1680
1693
|
# keyword argument `nocreate` to raise an exception instead.
|
|
@@ -1698,11 +1711,12 @@ module FileUtils
|
|
|
1698
1711
|
#
|
|
1699
1712
|
# Keyword arguments:
|
|
1700
1713
|
#
|
|
1701
|
-
# *
|
|
1702
|
-
# current time.
|
|
1703
|
-
# *
|
|
1704
|
-
#
|
|
1705
|
-
# *
|
|
1714
|
+
# * <code>mtime: <i>time</i></code> - sets the entry's mtime to the given
|
|
1715
|
+
# time, instead of the current time.
|
|
1716
|
+
# * <code>nocreate: true</code> - raises an exception if the entry does not
|
|
1717
|
+
# exist.
|
|
1718
|
+
# * <code>noop: true</code> - does not touch entries; returns `nil`.
|
|
1719
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1706
1720
|
#
|
|
1707
1721
|
# FileUtils.touch('src0.txt', noop: true, verbose: true)
|
|
1708
1722
|
# FileUtils.touch(['src0.txt', 'src0.dat'], noop: true, verbose: true)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# designated object, using the methods #def_delegator and #def_delegators.
|
|
4
4
|
#
|
|
5
5
|
# For example, say you have a class RecordCollection which contains an array
|
|
6
|
-
#
|
|
7
|
-
# simply calls #[] on the
|
|
6
|
+
# <code>@records</code>. You could provide the lookup method #record_number(),
|
|
7
|
+
# which simply calls #[] on the <code>@records</code> array, like this:
|
|
8
8
|
#
|
|
9
9
|
# require 'forwardable'
|
|
10
10
|
#
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
#
|
|
91
91
|
# Be advised, RDoc will not detect delegated methods.
|
|
92
92
|
#
|
|
93
|
-
#
|
|
94
|
-
# def_delegators methods. For full-class delegation via
|
|
95
|
-
#
|
|
93
|
+
# <code>forwardable.rb</code> provides single-method delegation via the
|
|
94
|
+
# def_delegator and def_delegators methods. For full-class delegation via
|
|
95
|
+
# DelegateClass, see <code>delegate.rb</code>.
|
|
96
96
|
#
|
|
97
97
|
module Forwardable
|
|
98
98
|
# <!-- rdoc-file=lib/forwardable.rb -->
|
|
99
|
-
# Version of
|
|
99
|
+
# Version of <code>forwardable.rb</code>
|
|
100
100
|
#
|
|
101
101
|
VERSION: String
|
|
102
102
|
|
|
@@ -151,10 +151,10 @@ module Forwardable
|
|
|
151
151
|
# - def_instance_delegator(accessor, method, ali = method)
|
|
152
152
|
# -->
|
|
153
153
|
# Define `method` as delegator instance method with an optional alias name
|
|
154
|
-
# `ali`. Method calls to `ali` will be delegated to
|
|
155
|
-
# `accessor` should be a method name, instance
|
|
156
|
-
# Use the full path to the constant if
|
|
157
|
-
# name of the method defined.
|
|
154
|
+
# `ali`. Method calls to `ali` will be delegated to
|
|
155
|
+
# <code>accessor.method</code>. `accessor` should be a method name, instance
|
|
156
|
+
# variable name, or constant name. Use the full path to the constant if
|
|
157
|
+
# providing the constant name. Returns the name of the method defined.
|
|
158
158
|
#
|
|
159
159
|
# class MyQueue
|
|
160
160
|
# CONST = 1
|