rbs 2.0.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +34 -0
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +82 -0
- data/README.md +6 -1
- data/Rakefile +56 -21
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +1214 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1060 -142
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2319 -318
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/docs/syntax.md +54 -11
- data/ext/rbs_extension/extconf.rb +1 -0
- data/ext/rbs_extension/lexer.h +5 -0
- data/ext/rbs_extension/lexstate.c +6 -0
- data/ext/rbs_extension/parser.c +85 -10
- data/ext/rbs_extension/ruby_objs.c +4 -2
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/goodcheck.yml +0 -11
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/ast/members.rb +21 -13
- data/lib/rbs/buffer.rb +17 -11
- data/lib/rbs/cli.rb +48 -1
- data/lib/rbs/definition_builder/method_builder.rb +28 -16
- data/lib/rbs/definition_builder.rb +6 -2
- data/lib/rbs/environment.rb +8 -4
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/type_alias_regularity.rb +6 -4
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +1 -1
- data/lib/rbs/validator.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +54 -4
- data/lib/rbs.rb +0 -2
- data/schema/typeParam.json +3 -3
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/buffer.rbs +6 -2
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/members.rbs +24 -18
- data/sig/method_builder.rbs +5 -4
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/sig/validator.rbs +3 -1
- data/sig/writer.rbs +79 -2
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +649 -21
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1147 -145
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/manifest.yaml +1 -0
- data/stdlib/net-http/0/net-http.rbs +1513 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +423 -109
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +558 -329
- data/stdlib/uri/0/http.rbs +60 -114
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +18 -6
- data/lib/rbs/location.rb +0 -221
- data/sig/char_scanner.rbs +0 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/fileutils.rb -->
|
|
1
2
|
# # fileutils.rb
|
|
2
3
|
#
|
|
3
4
|
# Copyright (c) 2000-2007 Minero Aoki
|
|
@@ -104,6 +105,10 @@ module FileUtils
|
|
|
104
105
|
|
|
105
106
|
type pathlist = path | Array[path]
|
|
106
107
|
|
|
108
|
+
# <!--
|
|
109
|
+
# rdoc-file=lib/fileutils.rb
|
|
110
|
+
# - cd(dir, verbose: nil) { |dir| ... }
|
|
111
|
+
# -->
|
|
107
112
|
# Changes the current directory to the directory `dir`.
|
|
108
113
|
#
|
|
109
114
|
# If this method is called with block, resumes to the previous working directory
|
|
@@ -120,9 +125,24 @@ module FileUtils
|
|
|
120
125
|
def self?.cd: (path dir, ?verbose: boolish) -> void
|
|
121
126
|
| [X] (path dir, ?verbose: boolish) { (String) -> X } -> X
|
|
122
127
|
|
|
128
|
+
# <!--
|
|
129
|
+
# rdoc-file=lib/fileutils.rb
|
|
130
|
+
# - chdir(dir, verbose: nil)
|
|
131
|
+
# -->
|
|
132
|
+
#
|
|
123
133
|
alias self.chdir self.cd
|
|
134
|
+
|
|
135
|
+
# <!--
|
|
136
|
+
# rdoc-file=lib/fileutils.rb
|
|
137
|
+
# - chdir(dir, verbose: nil)
|
|
138
|
+
# -->
|
|
139
|
+
#
|
|
124
140
|
alias chdir cd
|
|
125
141
|
|
|
142
|
+
# <!--
|
|
143
|
+
# rdoc-file=lib/fileutils.rb
|
|
144
|
+
# - chmod(mode, list, noop: nil, verbose: nil)
|
|
145
|
+
# -->
|
|
126
146
|
# Changes permission bits on the named files (in `list`) to the bit pattern
|
|
127
147
|
# represented by `mode`.
|
|
128
148
|
#
|
|
@@ -168,6 +188,10 @@ module FileUtils
|
|
|
168
188
|
#
|
|
169
189
|
def self?.chmod: (mode mode, pathlist list, ?noop: boolish, ?verbose: boolish) -> void
|
|
170
190
|
|
|
191
|
+
# <!--
|
|
192
|
+
# rdoc-file=lib/fileutils.rb
|
|
193
|
+
# - chmod_R(mode, list, noop: nil, verbose: nil, force: nil)
|
|
194
|
+
# -->
|
|
171
195
|
# Changes permission bits on the named files (in `list`) to the bit pattern
|
|
172
196
|
# represented by `mode`.
|
|
173
197
|
#
|
|
@@ -176,6 +200,10 @@ module FileUtils
|
|
|
176
200
|
#
|
|
177
201
|
def self?.chmod_R: (mode mode, pathlist list, ?noop: boolish, ?verbose: boolish, ?force: boolish) -> void
|
|
178
202
|
|
|
203
|
+
# <!--
|
|
204
|
+
# rdoc-file=lib/fileutils.rb
|
|
205
|
+
# - chown(user, group, list, noop: nil, verbose: nil)
|
|
206
|
+
# -->
|
|
179
207
|
# Changes owner and group on the named files (in `list`) to the user `user` and
|
|
180
208
|
# the group `group`. `user` and `group` may be an ID (Integer/String) or a name
|
|
181
209
|
# (String). If `user` or `group` is nil, this method does not change the
|
|
@@ -186,6 +214,10 @@ module FileUtils
|
|
|
186
214
|
#
|
|
187
215
|
def self?.chown: (String? user, String? group, pathlist list, ?noop: boolish, ?verbose: boolish) -> void
|
|
188
216
|
|
|
217
|
+
# <!--
|
|
218
|
+
# rdoc-file=lib/fileutils.rb
|
|
219
|
+
# - chown_R(user, group, list, noop: nil, verbose: nil, force: nil)
|
|
220
|
+
# -->
|
|
189
221
|
# Changes owner and group on the named files (in `list`) to the user `user` and
|
|
190
222
|
# the group `group` recursively. `user` and `group` may be an ID
|
|
191
223
|
# (Integer/String) or a name (String). If `user` or `group` is nil, this method
|
|
@@ -196,12 +228,20 @@ module FileUtils
|
|
|
196
228
|
#
|
|
197
229
|
def self?.chown_R: (String? user, String? group, pathlist list, ?noop: boolish, ?verbose: boolish, ?force: boolish) -> void
|
|
198
230
|
|
|
231
|
+
# <!--
|
|
232
|
+
# rdoc-file=lib/fileutils.rb
|
|
233
|
+
# - collect_method(opt)
|
|
234
|
+
# -->
|
|
199
235
|
# Returns an Array of methods names which have the option `opt`.
|
|
200
236
|
#
|
|
201
237
|
# p FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
|
|
202
238
|
#
|
|
203
239
|
def self.collect_method: (Symbol opt) -> Array[String]
|
|
204
240
|
|
|
241
|
+
# <!--
|
|
242
|
+
# rdoc-file=lib/fileutils.rb
|
|
243
|
+
# - commands()
|
|
244
|
+
# -->
|
|
205
245
|
# Returns an Array of names of high-level methods that accept any keyword
|
|
206
246
|
# arguments.
|
|
207
247
|
#
|
|
@@ -209,6 +249,10 @@ module FileUtils
|
|
|
209
249
|
#
|
|
210
250
|
def self.commands: () -> Array[String]
|
|
211
251
|
|
|
252
|
+
# <!--
|
|
253
|
+
# rdoc-file=lib/fileutils.rb
|
|
254
|
+
# - compare_file(a, b)
|
|
255
|
+
# -->
|
|
212
256
|
# Returns true if the contents of a file `a` and a file `b` are identical.
|
|
213
257
|
#
|
|
214
258
|
# FileUtils.compare_file('somefile', 'somefile') #=> true
|
|
@@ -216,16 +260,46 @@ module FileUtils
|
|
|
216
260
|
#
|
|
217
261
|
def self?.compare_file: (path a, path b) -> bool
|
|
218
262
|
|
|
263
|
+
# <!--
|
|
264
|
+
# rdoc-file=lib/fileutils.rb
|
|
265
|
+
# - cmp(a, b)
|
|
266
|
+
# -->
|
|
267
|
+
#
|
|
219
268
|
alias self.cmp self.compare_file
|
|
269
|
+
|
|
270
|
+
# <!--
|
|
271
|
+
# rdoc-file=lib/fileutils.rb
|
|
272
|
+
# - cmp(a, b)
|
|
273
|
+
# -->
|
|
274
|
+
#
|
|
220
275
|
alias cmp compare_file
|
|
221
276
|
|
|
277
|
+
# <!--
|
|
278
|
+
# rdoc-file=lib/fileutils.rb
|
|
279
|
+
# - identical?(a, b)
|
|
280
|
+
# -->
|
|
281
|
+
#
|
|
222
282
|
alias self.identical? self.compare_file
|
|
283
|
+
|
|
284
|
+
# <!--
|
|
285
|
+
# rdoc-file=lib/fileutils.rb
|
|
286
|
+
# - identical?(a, b)
|
|
287
|
+
# -->
|
|
288
|
+
#
|
|
223
289
|
alias identical? compare_file
|
|
224
290
|
|
|
291
|
+
# <!--
|
|
292
|
+
# rdoc-file=lib/fileutils.rb
|
|
293
|
+
# - compare_stream(a, b)
|
|
294
|
+
# -->
|
|
225
295
|
# Returns true if the contents of a stream `a` and `b` are identical.
|
|
226
296
|
#
|
|
227
297
|
def self?.compare_stream: (IO a, IO b) -> bool
|
|
228
298
|
|
|
299
|
+
# <!--
|
|
300
|
+
# rdoc-file=lib/fileutils.rb
|
|
301
|
+
# - copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
|
|
302
|
+
# -->
|
|
229
303
|
# Copies a file system entry `src` to `dest`. If `src` is a directory, this
|
|
230
304
|
# method copies its contents recursively. This method preserves file types, c.f.
|
|
231
305
|
# symlink, directory... (FIFO, device files and etc. are not supported yet)
|
|
@@ -243,16 +317,28 @@ module FileUtils
|
|
|
243
317
|
#
|
|
244
318
|
def self?.copy_entry: (path src, path dest, ?boolish preserve, ?boolish dereference_root, ?boolish remove_destination) -> void
|
|
245
319
|
|
|
320
|
+
# <!--
|
|
321
|
+
# rdoc-file=lib/fileutils.rb
|
|
322
|
+
# - copy_file(src, dest, preserve = false, dereference = true)
|
|
323
|
+
# -->
|
|
246
324
|
# Copies file contents of `src` to `dest`. Both of `src` and `dest` must be a
|
|
247
325
|
# path name.
|
|
248
326
|
#
|
|
249
327
|
def self?.copy_file: (path src, path dest, ?boolish preserve, ?boolish dereference) -> void
|
|
250
328
|
|
|
329
|
+
# <!--
|
|
330
|
+
# rdoc-file=lib/fileutils.rb
|
|
331
|
+
# - copy_stream(src, dest)
|
|
332
|
+
# -->
|
|
251
333
|
# Copies stream `src` to `dest`. `src` must respond to #read(n) and `dest` must
|
|
252
334
|
# respond to #write(str).
|
|
253
335
|
#
|
|
254
336
|
def self?.copy_stream: (_Reader src, _Writer dest) -> void
|
|
255
337
|
|
|
338
|
+
# <!--
|
|
339
|
+
# rdoc-file=lib/fileutils.rb
|
|
340
|
+
# - cp(src, dest, preserve: nil, noop: nil, verbose: nil)
|
|
341
|
+
# -->
|
|
256
342
|
# Copies a file content `src` to `dest`. If `dest` is a directory, copies `src`
|
|
257
343
|
# to `dest/src`.
|
|
258
344
|
#
|
|
@@ -265,9 +351,24 @@ module FileUtils
|
|
|
265
351
|
#
|
|
266
352
|
def self?.cp: (pathlist src, path dest, ?preserve: boolish, ?noop: boolish, ?verbose: boolish) -> void
|
|
267
353
|
|
|
354
|
+
# <!--
|
|
355
|
+
# rdoc-file=lib/fileutils.rb
|
|
356
|
+
# - copy(src, dest, preserve: nil, noop: nil, verbose: nil)
|
|
357
|
+
# -->
|
|
358
|
+
#
|
|
268
359
|
alias self.copy self.cp
|
|
360
|
+
|
|
361
|
+
# <!--
|
|
362
|
+
# rdoc-file=lib/fileutils.rb
|
|
363
|
+
# - copy(src, dest, preserve: nil, noop: nil, verbose: nil)
|
|
364
|
+
# -->
|
|
365
|
+
#
|
|
269
366
|
alias copy cp
|
|
270
367
|
|
|
368
|
+
# <!--
|
|
369
|
+
# rdoc-file=lib/fileutils.rb
|
|
370
|
+
# - cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false)
|
|
371
|
+
# -->
|
|
271
372
|
# Hard link `src` to `dest`. If `src` is a directory, this method links all its
|
|
272
373
|
# contents recursively. If `dest` is a directory, links `src` to `dest/src`.
|
|
273
374
|
#
|
|
@@ -292,6 +393,10 @@ module FileUtils
|
|
|
292
393
|
#
|
|
293
394
|
def self?.cp_lr: (pathlist src, path dest, ?noop: boolish, ?verbose: boolish, ?dereference_root: boolish, ?remove_destination: boolish) -> void
|
|
294
395
|
|
|
396
|
+
# <!--
|
|
397
|
+
# rdoc-file=lib/fileutils.rb
|
|
398
|
+
# - cp_r(src, dest, preserve: nil, noop: nil, verbose: nil, dereference_root: true, remove_destination: nil)
|
|
399
|
+
# -->
|
|
295
400
|
# Copies `src` to `dest`. If `src` is a directory, this method copies all its
|
|
296
401
|
# contents recursively. If `dest` is a directory, copies `src` to `dest/src`.
|
|
297
402
|
#
|
|
@@ -318,6 +423,10 @@ module FileUtils
|
|
|
318
423
|
#
|
|
319
424
|
def self?.cp_r: (pathlist src, path dest, ?preserve: boolish, ?noop: boolish, ?verbose: boolish, ?dereference_root: boolish, ?remove_destination: boolish) -> void
|
|
320
425
|
|
|
426
|
+
# <!--
|
|
427
|
+
# rdoc-file=lib/fileutils.rb
|
|
428
|
+
# - have_option?(mid, opt)
|
|
429
|
+
# -->
|
|
321
430
|
# Returns true if the method `mid` have an option `opt`.
|
|
322
431
|
#
|
|
323
432
|
# p FileUtils.have_option?(:cp, :noop) #=> true
|
|
@@ -326,6 +435,10 @@ module FileUtils
|
|
|
326
435
|
#
|
|
327
436
|
def self.have_option?: (Symbol mid, Symbol opt) -> bool
|
|
328
437
|
|
|
438
|
+
# <!--
|
|
439
|
+
# rdoc-file=lib/fileutils.rb
|
|
440
|
+
# - install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil, noop: nil, verbose: nil)
|
|
441
|
+
# -->
|
|
329
442
|
# If `src` is not same as `dest`, copies it and changes the permission mode to
|
|
330
443
|
# `mode`. If `dest` is a directory, destination is `dest`/`src`. This method
|
|
331
444
|
# removes destination before copy.
|
|
@@ -335,6 +448,10 @@ module FileUtils
|
|
|
335
448
|
#
|
|
336
449
|
def self?.install: (path src, path dest, ?mode: mode?, ?owner: String?, ?group: String?, ?preserve: boolish, ?noop: boolish, ?verbose: boolish) -> void
|
|
337
450
|
|
|
451
|
+
# <!--
|
|
452
|
+
# rdoc-file=lib/fileutils.rb
|
|
453
|
+
# - link_entry(src, dest, dereference_root = false, remove_destination = false)
|
|
454
|
+
# -->
|
|
338
455
|
# Hard links a file system entry `src` to `dest`. If `src` is a directory, this
|
|
339
456
|
# method links its contents recursively.
|
|
340
457
|
#
|
|
@@ -348,6 +465,12 @@ module FileUtils
|
|
|
348
465
|
#
|
|
349
466
|
def self?.link_entry: (path src, path dest, ?boolish dereference_root, ?boolish remove_destination) -> void
|
|
350
467
|
|
|
468
|
+
# <!--
|
|
469
|
+
# rdoc-file=lib/fileutils.rb
|
|
470
|
+
# - FileUtils.ln(target, link, force: nil, noop: nil, verbose: nil)
|
|
471
|
+
# - FileUtils.ln(target, dir, force: nil, noop: nil, verbose: nil)
|
|
472
|
+
# - FileUtils.ln(targets, dir, force: nil, noop: nil, verbose: nil)
|
|
473
|
+
# -->
|
|
351
474
|
# In the first form, creates a hard link `link` which points to `target`. If
|
|
352
475
|
# `link` already exists, raises Errno::EEXIST. But if the `force` option is set,
|
|
353
476
|
# overwrites `link`.
|
|
@@ -364,9 +487,26 @@ module FileUtils
|
|
|
364
487
|
#
|
|
365
488
|
def self?.ln: (pathlist src, path dest, ?force: boolish, ?noop: boolish, ?verbose: boolish) -> void
|
|
366
489
|
|
|
490
|
+
# <!--
|
|
491
|
+
# rdoc-file=lib/fileutils.rb
|
|
492
|
+
# - link(src, dest, force: nil, noop: nil, verbose: nil)
|
|
493
|
+
# -->
|
|
494
|
+
#
|
|
367
495
|
alias self.link self.ln
|
|
496
|
+
|
|
497
|
+
# <!--
|
|
498
|
+
# rdoc-file=lib/fileutils.rb
|
|
499
|
+
# - link(src, dest, force: nil, noop: nil, verbose: nil)
|
|
500
|
+
# -->
|
|
501
|
+
#
|
|
368
502
|
alias link ln
|
|
369
503
|
|
|
504
|
+
# <!--
|
|
505
|
+
# rdoc-file=lib/fileutils.rb
|
|
506
|
+
# - FileUtils.ln_s(target, link, force: nil, noop: nil, verbose: nil)
|
|
507
|
+
# - FileUtils.ln_s(target, dir, force: nil, noop: nil, verbose: nil)
|
|
508
|
+
# - FileUtils.ln_s(targets, dir, force: nil, noop: nil, verbose: nil)
|
|
509
|
+
# -->
|
|
370
510
|
# In the first form, creates a symbolic link `link` which points to `target`. If
|
|
371
511
|
# `link` already exists, raises Errno::EEXIST. But if the `force` option is set,
|
|
372
512
|
# overwrites `link`.
|
|
@@ -382,15 +522,34 @@ module FileUtils
|
|
|
382
522
|
#
|
|
383
523
|
def self?.ln_s: (pathlist src, path dest, ?force: boolish, ?noop: boolish, ?verbose: boolish) -> void
|
|
384
524
|
|
|
525
|
+
# <!--
|
|
526
|
+
# rdoc-file=lib/fileutils.rb
|
|
527
|
+
# - symlink(src, dest, force: nil, noop: nil, verbose: nil)
|
|
528
|
+
# -->
|
|
529
|
+
#
|
|
385
530
|
alias self.symlink self.ln_s
|
|
531
|
+
|
|
532
|
+
# <!--
|
|
533
|
+
# rdoc-file=lib/fileutils.rb
|
|
534
|
+
# - symlink(src, dest, force: nil, noop: nil, verbose: nil)
|
|
535
|
+
# -->
|
|
536
|
+
#
|
|
386
537
|
alias symlink ln_s
|
|
387
538
|
|
|
539
|
+
# <!--
|
|
540
|
+
# rdoc-file=lib/fileutils.rb
|
|
541
|
+
# - FileUtils.ln_sf(*args)
|
|
542
|
+
# -->
|
|
388
543
|
# Same as
|
|
389
544
|
#
|
|
390
545
|
# FileUtils.ln_s(*args, force: true)
|
|
391
546
|
#
|
|
392
547
|
def self?.ln_sf: (pathlist src, path dest, ?noop: boolish, ?verbose: boolish) -> void
|
|
393
548
|
|
|
549
|
+
# <!--
|
|
550
|
+
# rdoc-file=lib/fileutils.rb
|
|
551
|
+
# - mkdir(list, mode: nil, noop: nil, verbose: nil)
|
|
552
|
+
# -->
|
|
394
553
|
# Creates one or more directories.
|
|
395
554
|
#
|
|
396
555
|
# FileUtils.mkdir 'test'
|
|
@@ -400,6 +559,10 @@ module FileUtils
|
|
|
400
559
|
#
|
|
401
560
|
def self?.mkdir: (pathlist list, ?mode: Integer?, ?noop: boolish, ?verbose: boolish) -> void
|
|
402
561
|
|
|
562
|
+
# <!--
|
|
563
|
+
# rdoc-file=lib/fileutils.rb
|
|
564
|
+
# - mkdir_p(list, mode: nil, noop: nil, verbose: nil)
|
|
565
|
+
# -->
|
|
403
566
|
# Creates a directory and all its parent directories. For example,
|
|
404
567
|
#
|
|
405
568
|
# FileUtils.mkdir_p '/usr/local/lib/ruby'
|
|
@@ -416,12 +579,38 @@ module FileUtils
|
|
|
416
579
|
#
|
|
417
580
|
def self?.mkdir_p: (pathlist list, ?mode: mode?, ?noop: boolish, ?verbose: boolish) -> void
|
|
418
581
|
|
|
582
|
+
# <!--
|
|
583
|
+
# rdoc-file=lib/fileutils.rb
|
|
584
|
+
# - makedirs(list, mode: nil, noop: nil, verbose: nil)
|
|
585
|
+
# -->
|
|
586
|
+
#
|
|
419
587
|
alias self.makedirs self.mkdir_p
|
|
588
|
+
|
|
589
|
+
# <!--
|
|
590
|
+
# rdoc-file=lib/fileutils.rb
|
|
591
|
+
# - makedirs(list, mode: nil, noop: nil, verbose: nil)
|
|
592
|
+
# -->
|
|
593
|
+
#
|
|
420
594
|
alias makedirs mkdir_p
|
|
421
595
|
|
|
596
|
+
# <!--
|
|
597
|
+
# rdoc-file=lib/fileutils.rb
|
|
598
|
+
# - mkpath(list, mode: nil, noop: nil, verbose: nil)
|
|
599
|
+
# -->
|
|
600
|
+
#
|
|
422
601
|
alias self.mkpath self.mkdir_p
|
|
602
|
+
|
|
603
|
+
# <!--
|
|
604
|
+
# rdoc-file=lib/fileutils.rb
|
|
605
|
+
# - mkpath(list, mode: nil, noop: nil, verbose: nil)
|
|
606
|
+
# -->
|
|
607
|
+
#
|
|
423
608
|
alias mkpath mkdir_p
|
|
424
609
|
|
|
610
|
+
# <!--
|
|
611
|
+
# rdoc-file=lib/fileutils.rb
|
|
612
|
+
# - mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
|
|
613
|
+
# -->
|
|
425
614
|
# Moves file(s) `src` to `dest`. If `file` and `dest` exist on the different
|
|
426
615
|
# disk partition, the file is copied then the original file is removed.
|
|
427
616
|
#
|
|
@@ -433,33 +622,75 @@ module FileUtils
|
|
|
433
622
|
#
|
|
434
623
|
def self?.mv: (pathlist src, path dest, ?force: boolish, ?noop: boolish, ?verbose: boolish, ?secure: boolish) -> void
|
|
435
624
|
|
|
625
|
+
# <!--
|
|
626
|
+
# rdoc-file=lib/fileutils.rb
|
|
627
|
+
# - move(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
|
|
628
|
+
# -->
|
|
629
|
+
#
|
|
436
630
|
alias self.move self.mv
|
|
631
|
+
|
|
632
|
+
# <!--
|
|
633
|
+
# rdoc-file=lib/fileutils.rb
|
|
634
|
+
# - move(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
|
|
635
|
+
# -->
|
|
636
|
+
#
|
|
437
637
|
alias move mv
|
|
438
638
|
|
|
639
|
+
# <!--
|
|
640
|
+
# rdoc-file=lib/fileutils.rb
|
|
641
|
+
# - options()
|
|
642
|
+
# -->
|
|
439
643
|
# Returns an Array of option names.
|
|
440
644
|
#
|
|
441
645
|
# p FileUtils.options #=> ["noop", "force", "verbose", "preserve", "mode"]
|
|
442
646
|
#
|
|
443
647
|
def self.options: () -> Array[String]
|
|
444
648
|
|
|
649
|
+
# <!--
|
|
650
|
+
# rdoc-file=lib/fileutils.rb
|
|
651
|
+
# - options_of(mid)
|
|
652
|
+
# -->
|
|
445
653
|
# Returns an Array of option names of the method `mid`.
|
|
446
654
|
#
|
|
447
655
|
# p FileUtils.options_of(:rm) #=> ["noop", "verbose", "force"]
|
|
448
656
|
#
|
|
449
657
|
def self.options_of: (Symbol mid) -> Array[String]
|
|
450
658
|
|
|
659
|
+
# <!--
|
|
660
|
+
# rdoc-file=lib/fileutils.rb
|
|
661
|
+
# - pwd()
|
|
662
|
+
# -->
|
|
451
663
|
# Returns the name of the current directory.
|
|
452
664
|
#
|
|
453
665
|
def self?.pwd: () -> String
|
|
454
666
|
|
|
667
|
+
# <!--
|
|
668
|
+
# rdoc-file=lib/fileutils.rb
|
|
669
|
+
# - getwd()
|
|
670
|
+
# -->
|
|
671
|
+
#
|
|
455
672
|
alias self.getwd self.pwd
|
|
673
|
+
|
|
674
|
+
# <!--
|
|
675
|
+
# rdoc-file=lib/fileutils.rb
|
|
676
|
+
# - getwd()
|
|
677
|
+
# -->
|
|
678
|
+
#
|
|
456
679
|
alias getwd pwd
|
|
457
680
|
|
|
681
|
+
# <!--
|
|
682
|
+
# rdoc-file=lib/fileutils.rb
|
|
683
|
+
# - remove_dir(path, force = false)
|
|
684
|
+
# -->
|
|
458
685
|
# Removes a directory `dir` and its contents recursively. This method ignores
|
|
459
686
|
# StandardError if `force` is true.
|
|
460
687
|
#
|
|
461
688
|
def self?.remove_dir: (path path, ?boolish force) -> void
|
|
462
689
|
|
|
690
|
+
# <!--
|
|
691
|
+
# rdoc-file=lib/fileutils.rb
|
|
692
|
+
# - remove_entry(path, force = false)
|
|
693
|
+
# -->
|
|
463
694
|
# This method removes a file system entry `path`. `path` might be a regular
|
|
464
695
|
# file, a directory, or something. If `path` is a directory, remove it
|
|
465
696
|
# recursively.
|
|
@@ -468,6 +699,10 @@ module FileUtils
|
|
|
468
699
|
#
|
|
469
700
|
def self?.remove_entry: (path path, ?boolish force) -> void
|
|
470
701
|
|
|
702
|
+
# <!--
|
|
703
|
+
# rdoc-file=lib/fileutils.rb
|
|
704
|
+
# - remove_entry_secure(path, force = false)
|
|
705
|
+
# -->
|
|
471
706
|
# This method removes a file system entry `path`. `path` shall be a regular
|
|
472
707
|
# file, a directory, or something. If `path` is a directory, remove it
|
|
473
708
|
# recursively. This method is required to avoid TOCTTOU
|
|
@@ -502,10 +737,18 @@ module FileUtils
|
|
|
502
737
|
#
|
|
503
738
|
def self?.remove_entry_secure: (path path, ?boolish force) -> void
|
|
504
739
|
|
|
740
|
+
# <!--
|
|
741
|
+
# rdoc-file=lib/fileutils.rb
|
|
742
|
+
# - remove_file(path, force = false)
|
|
743
|
+
# -->
|
|
505
744
|
# Removes a file `path`. This method ignores StandardError if `force` is true.
|
|
506
745
|
#
|
|
507
746
|
def self?.remove_file: (path path, ?void force) -> void
|
|
508
747
|
|
|
748
|
+
# <!--
|
|
749
|
+
# rdoc-file=lib/fileutils.rb
|
|
750
|
+
# - rm(list, force: nil, noop: nil, verbose: nil)
|
|
751
|
+
# -->
|
|
509
752
|
# Remove file(s) specified in `list`. This method cannot remove directories.
|
|
510
753
|
# All StandardErrors are ignored when the :force option is set.
|
|
511
754
|
#
|
|
@@ -515,19 +758,49 @@ module FileUtils
|
|
|
515
758
|
#
|
|
516
759
|
def self?.rm: (pathlist list, ?force: boolish, ?noop: boolish, ?verbose: boolish) -> void
|
|
517
760
|
|
|
761
|
+
# <!--
|
|
762
|
+
# rdoc-file=lib/fileutils.rb
|
|
763
|
+
# - remove(list, force: nil, noop: nil, verbose: nil)
|
|
764
|
+
# -->
|
|
765
|
+
#
|
|
518
766
|
alias self.remove self.rm
|
|
767
|
+
|
|
768
|
+
# <!--
|
|
769
|
+
# rdoc-file=lib/fileutils.rb
|
|
770
|
+
# - remove(list, force: nil, noop: nil, verbose: nil)
|
|
771
|
+
# -->
|
|
772
|
+
#
|
|
519
773
|
alias remove rm
|
|
520
774
|
|
|
775
|
+
# <!--
|
|
776
|
+
# rdoc-file=lib/fileutils.rb
|
|
777
|
+
# - rm_f(list, noop: nil, verbose: nil)
|
|
778
|
+
# -->
|
|
521
779
|
# Equivalent to
|
|
522
780
|
#
|
|
523
781
|
# FileUtils.rm(list, force: true)
|
|
524
782
|
#
|
|
525
783
|
def self?.rm_f: (pathlist list, ?noop: boolish, ?verbose: boolish) -> void
|
|
526
784
|
|
|
785
|
+
# <!--
|
|
786
|
+
# rdoc-file=lib/fileutils.rb
|
|
787
|
+
# - safe_unlink(list, noop: nil, verbose: nil)
|
|
788
|
+
# -->
|
|
789
|
+
#
|
|
527
790
|
alias self.safe_unlink self.rm_f
|
|
791
|
+
|
|
792
|
+
# <!--
|
|
793
|
+
# rdoc-file=lib/fileutils.rb
|
|
794
|
+
# - safe_unlink(list, noop: nil, verbose: nil)
|
|
795
|
+
# -->
|
|
796
|
+
#
|
|
528
797
|
alias safe_unlink rm_f
|
|
529
798
|
|
|
530
|
-
#
|
|
799
|
+
# <!--
|
|
800
|
+
# rdoc-file=lib/fileutils.rb
|
|
801
|
+
# - rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
|
|
802
|
+
# -->
|
|
803
|
+
# remove files `list`[0] `list`[1]... If `list`[n] is a directory, removes its
|
|
531
804
|
# all contents recursively. This method ignores StandardError when :force option
|
|
532
805
|
# is set.
|
|
533
806
|
#
|
|
@@ -546,6 +819,10 @@ module FileUtils
|
|
|
546
819
|
#
|
|
547
820
|
def self?.rm_r: (pathlist list, ?force: boolish, ?noop: boolish, ?verbose: boolish, ?secure: boolish) -> void
|
|
548
821
|
|
|
822
|
+
# <!--
|
|
823
|
+
# rdoc-file=lib/fileutils.rb
|
|
824
|
+
# - rm_rf(list, noop: nil, verbose: nil, secure: nil)
|
|
825
|
+
# -->
|
|
549
826
|
# Equivalent to
|
|
550
827
|
#
|
|
551
828
|
# FileUtils.rm_r(list, force: true)
|
|
@@ -555,9 +832,24 @@ module FileUtils
|
|
|
555
832
|
#
|
|
556
833
|
def self?.rm_rf: (pathlist list, ?noop: boolish, ?verbose: boolish, ?secure: boolish) -> void
|
|
557
834
|
|
|
835
|
+
# <!--
|
|
836
|
+
# rdoc-file=lib/fileutils.rb
|
|
837
|
+
# - rmtree(list, noop: nil, verbose: nil, secure: nil)
|
|
838
|
+
# -->
|
|
839
|
+
#
|
|
558
840
|
alias self.rmtree self.rm_rf
|
|
841
|
+
|
|
842
|
+
# <!--
|
|
843
|
+
# rdoc-file=lib/fileutils.rb
|
|
844
|
+
# - rmtree(list, noop: nil, verbose: nil, secure: nil)
|
|
845
|
+
# -->
|
|
846
|
+
#
|
|
559
847
|
alias rmtree rm_rf
|
|
560
848
|
|
|
849
|
+
# <!--
|
|
850
|
+
# rdoc-file=lib/fileutils.rb
|
|
851
|
+
# - rmdir(list, parents: nil, noop: nil, verbose: nil)
|
|
852
|
+
# -->
|
|
561
853
|
# Removes one or more directories.
|
|
562
854
|
#
|
|
563
855
|
# FileUtils.rmdir 'somedir'
|
|
@@ -567,6 +859,10 @@ module FileUtils
|
|
|
567
859
|
#
|
|
568
860
|
def self?.rmdir: (pathlist list, ?parents: boolish, ?noop: boolish, ?verbose: boolish) -> void
|
|
569
861
|
|
|
862
|
+
# <!--
|
|
863
|
+
# rdoc-file=lib/fileutils.rb
|
|
864
|
+
# - touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil)
|
|
865
|
+
# -->
|
|
570
866
|
# Updates modification time (mtime) and access time (atime) of file(s) in
|
|
571
867
|
# `list`. Files are created if they don't exist.
|
|
572
868
|
#
|
|
@@ -575,6 +871,10 @@ module FileUtils
|
|
|
575
871
|
#
|
|
576
872
|
def self?.touch: (pathlist list, ?noop: boolish, ?verbose: boolish, ?mtime: (Time | Numeric)?, ?nocreate: boolish) -> void
|
|
577
873
|
|
|
874
|
+
# <!--
|
|
875
|
+
# rdoc-file=lib/fileutils.rb
|
|
876
|
+
# - uptodate?(new, old_list)
|
|
877
|
+
# -->
|
|
578
878
|
# Returns true if `new` is newer than all `old_list`. Non-existent files are
|
|
579
879
|
# older than any file.
|
|
580
880
|
#
|
data/stdlib/find/0/find.rbs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/find.rb -->
|
|
1
2
|
# The `Find` module supports the top-down traversal of a set of file paths.
|
|
2
3
|
#
|
|
3
4
|
# For example, to total the size of all files under your home directory,
|
|
@@ -20,6 +21,10 @@
|
|
|
20
21
|
# end
|
|
21
22
|
#
|
|
22
23
|
module Find
|
|
24
|
+
# <!--
|
|
25
|
+
# rdoc-file=lib/find.rb
|
|
26
|
+
# - find(*paths, ignore_error: true) { |path| ... }
|
|
27
|
+
# -->
|
|
23
28
|
# Calls the associated block with the name of every file and directory listed as
|
|
24
29
|
# arguments, then recursively on their subdirectories, and so on.
|
|
25
30
|
#
|
|
@@ -30,6 +35,10 @@ module Find
|
|
|
30
35
|
def self?.find: (*String | _ToPath paths, ?ignore_error: boolish) -> Enumerator[String, nil]
|
|
31
36
|
| (*String | _ToPath paths, ?ignore_error: boolish) { (String) -> void } -> nil
|
|
32
37
|
|
|
38
|
+
# <!--
|
|
39
|
+
# rdoc-file=lib/find.rb
|
|
40
|
+
# - prune()
|
|
41
|
+
# -->
|
|
33
42
|
# Skips the current file or directory, restarting the loop with the next entry.
|
|
34
43
|
# If the current file is a directory, that directory will not be recursively
|
|
35
44
|
# entered. Meaningful only within the block associated with Find::find.
|