rbs 0.12.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/CHANGELOG.md +31 -0
- data/Gemfile +3 -0
- data/README.md +8 -2
- data/Rakefile +2 -2
- data/Steepfile +1 -0
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/docs/CONTRIBUTING.md +1 -0
- data/docs/syntax.md +50 -6
- data/goodcheck.yml +22 -5
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/cli.rb +12 -4
- data/lib/rbs/constant.rb +1 -1
- data/lib/rbs/constant_table.rb +9 -8
- data/lib/rbs/definition_builder.rb +6 -7
- data/lib/rbs/environment.rb +5 -1
- data/lib/rbs/environment_loader.rb +12 -12
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3148 -0
- data/lib/rbs/parser.y +10 -3
- data/lib/rbs/prototype/rb.rb +38 -6
- data/lib/rbs/prototype/runtime.rb +17 -7
- data/lib/rbs/test/hook.rb +2 -0
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/tester.rb +4 -1
- data/lib/rbs/test/type_check.rb +12 -6
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/variance_calculator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +25 -15
- data/sig/constant.rbs +21 -0
- data/sig/constant_table.rbs +30 -0
- data/sig/declarations.rbs +2 -2
- data/sig/definition.rbs +2 -2
- data/sig/definition_builder.rbs +4 -5
- data/sig/environment_loader.rbs +54 -0
- data/sig/members.rbs +2 -2
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +4 -4
- data/sig/parser.rbs +25 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/version.rbs +3 -0
- data/sig/writer.rbs +40 -0
- data/stdlib/base64/base64.rbs +1 -1
- data/stdlib/benchmark/benchmark.rbs +2 -2
- data/stdlib/builtin/array.rbs +124 -120
- data/stdlib/builtin/basic_object.rbs +54 -54
- data/stdlib/builtin/binding.rbs +42 -42
- data/stdlib/builtin/builtin.rbs +28 -0
- data/stdlib/builtin/class.rbs +33 -33
- data/stdlib/builtin/complex.rbs +90 -90
- data/stdlib/builtin/encoding.rbs +33 -33
- data/stdlib/builtin/enumerable.rbs +58 -52
- data/stdlib/builtin/enumerator.rbs +35 -35
- data/stdlib/builtin/errors.rbs +2 -2
- data/stdlib/builtin/exception.rbs +50 -50
- data/stdlib/builtin/false_class.rbs +6 -6
- data/stdlib/builtin/fiber.rbs +14 -14
- data/stdlib/builtin/fiber_error.rbs +1 -1
- data/stdlib/builtin/float.rbs +161 -161
- data/stdlib/builtin/gc.rbs +3 -3
- data/stdlib/builtin/hash.rbs +7 -7
- data/stdlib/builtin/io.rbs +88 -88
- data/stdlib/builtin/kernel.rbs +71 -153
- data/stdlib/builtin/match_data.rbs +1 -1
- data/stdlib/builtin/method.rbs +19 -19
- data/stdlib/builtin/module.rbs +13 -13
- data/stdlib/builtin/nil_class.rbs +20 -20
- data/stdlib/builtin/numeric.rbs +101 -101
- data/stdlib/builtin/object.rbs +173 -173
- data/stdlib/builtin/proc.rbs +91 -91
- data/stdlib/builtin/random.rbs +1 -1
- data/stdlib/builtin/range.rbs +3 -5
- data/stdlib/builtin/rational.rbs +83 -83
- data/stdlib/builtin/signal.rbs +7 -7
- data/stdlib/builtin/string.rbs +10 -10
- data/stdlib/builtin/string_io.rbs +8 -8
- data/stdlib/builtin/struct.rbs +1 -1
- data/stdlib/builtin/symbol.rbs +1 -1
- data/stdlib/builtin/thread.rbs +189 -189
- data/stdlib/builtin/thread_group.rbs +2 -2
- data/stdlib/builtin/true_class.rbs +10 -10
- data/stdlib/builtin/warning.rbs +1 -1
- data/stdlib/coverage/coverage.rbs +2 -2
- data/stdlib/csv/csv.rbs +1 -1
- data/stdlib/date/date.rbs +4 -4
- data/stdlib/date/date_time.rbs +1 -1
- data/stdlib/find/find.rbs +12 -12
- data/stdlib/logger/log_device.rbs +1 -1
- data/stdlib/logger/logger.rbs +1 -1
- data/stdlib/pathname/pathname.rbs +41 -39
- data/stdlib/pstore/pstore.rbs +287 -0
- data/stdlib/pty/pty.rbs +5 -29
- data/stdlib/tmpdir/tmpdir.rbs +12 -12
- data/stdlib/uri/generic.rbs +2 -2
- data/stdlib/uri/http.rbs +158 -0
- data/stdlib/uri/https.rbs +108 -0
- data/stdlib/uri/ldap.rbs +224 -0
- data/stdlib/uri/ldaps.rbs +108 -0
- data/steep/Gemfile.lock +13 -17
- metadata +13 -3
data/stdlib/builtin/kernel.rbs
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# The [Kernel](Kernel) module is included by class
|
2
2
|
# [Object](https://ruby-doc.org/core-2.6.3/Object.html), so its methods
|
3
3
|
# are available in every Ruby object.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# The [Kernel](Kernel) instance methods are documented
|
6
6
|
# in class [Object](https://ruby-doc.org/core-2.6.3/Object.html) while the
|
7
7
|
# module methods are documented here. These methods are called without a
|
8
8
|
# receiver and thus can be called in functional form:
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# ```ruby
|
11
11
|
# sprintf "%.1f", 1.234 #=> "1.2"
|
12
12
|
# ```
|
13
13
|
module Kernel
|
14
|
+
private
|
15
|
+
|
14
16
|
def caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
|
15
17
|
| (?::Range[Integer] start_or_range) -> ::Array[String]?
|
16
18
|
| () -> ::Array[String]
|
@@ -22,13 +24,13 @@ module Kernel
|
|
22
24
|
| () { (Object tag) -> untyped } -> untyped
|
23
25
|
|
24
26
|
# In a perfect world this should be:
|
25
|
-
#
|
27
|
+
#
|
26
28
|
# returns(T.class_of(T.self_type))
|
27
|
-
#
|
29
|
+
#
|
28
30
|
# but that doesn't work (yet). Even making it:
|
29
|
-
#
|
31
|
+
#
|
30
32
|
# returns(Class)
|
31
|
-
#
|
33
|
+
#
|
32
34
|
# is very surprising since users expect their methods to be present.
|
33
35
|
# So we settle for untyped.
|
34
36
|
def `class`: () -> untyped
|
@@ -40,7 +42,7 @@ module Kernel
|
|
40
42
|
|
41
43
|
# Returns `true` if `yield` would execute a block in the current context.
|
42
44
|
# The `iterator?` form is mildly deprecated.
|
43
|
-
#
|
45
|
+
#
|
44
46
|
# ```ruby
|
45
47
|
# def try
|
46
48
|
# if block_given?
|
@@ -57,7 +59,7 @@ module Kernel
|
|
57
59
|
alias block_given? iterator?
|
58
60
|
|
59
61
|
# Returns the names of the current local variables.
|
60
|
-
#
|
62
|
+
#
|
61
63
|
# ```ruby
|
62
64
|
# fred = 1
|
63
65
|
# for i in 1..10
|
@@ -69,28 +71,6 @@ module Kernel
|
|
69
71
|
|
70
72
|
def srand: (?Numeric number) -> Numeric
|
71
73
|
|
72
|
-
def !~: (untyped other) -> bool
|
73
|
-
|
74
|
-
def <=>: (untyped other) -> Integer?
|
75
|
-
|
76
|
-
def ===: (untyped other) -> bool
|
77
|
-
|
78
|
-
def =~: (untyped other) -> NilClass
|
79
|
-
|
80
|
-
def clone: (?freeze: (TrueClass | FalseClass)) -> self
|
81
|
-
|
82
|
-
def display: (?IO port) -> NilClass
|
83
|
-
|
84
|
-
def dup: () -> self
|
85
|
-
|
86
|
-
def enum_for: (Symbol method, *untyped args) -> ::Enumerator[untyped, untyped]
|
87
|
-
| (Symbol method, *untyped args) { (*untyped args) -> (Integer|Float|nil) } -> ::Enumerator[untyped, untyped]
|
88
|
-
alias to_enum enum_for
|
89
|
-
|
90
|
-
def eql?: (untyped other) -> bool
|
91
|
-
|
92
|
-
def `extend`: (*Module mod) -> self
|
93
|
-
|
94
74
|
# Creates a subprocess. If a block is specified, that block is run in the
|
95
75
|
# subprocess, and the subprocess terminates with a status of zero.
|
96
76
|
# Otherwise, the `fork` call returns twice, once in the parent, returning
|
@@ -100,93 +80,31 @@ module Kernel
|
|
100
80
|
# collect the termination statuses of its children or use `Process.detach`
|
101
81
|
# to register disinterest in their status; otherwise, the operating system
|
102
82
|
# may accumulate zombie processes.
|
103
|
-
#
|
83
|
+
#
|
104
84
|
# The thread calling fork is the only thread in the created child process.
|
105
85
|
# fork doesn’t copy other threads.
|
106
|
-
#
|
86
|
+
#
|
107
87
|
# If fork is not usable, Process.respond\_to?(:fork) returns false.
|
108
|
-
#
|
88
|
+
#
|
109
89
|
# Note that fork(2) is not available on some platforms like Windows and
|
110
90
|
# NetBSD 4. Therefore you should use spawn() instead of fork().
|
111
91
|
def fork: () -> Integer?
|
112
92
|
| () { () -> untyped } -> Integer?
|
113
93
|
|
114
|
-
def freeze: () -> self
|
115
|
-
|
116
|
-
def frozen?: () -> bool
|
117
|
-
|
118
|
-
def hash: () -> Integer
|
119
|
-
|
120
94
|
def initialize_copy: (self object) -> self
|
121
95
|
|
122
|
-
def inspect: () -> String
|
123
|
-
|
124
|
-
def instance_of?: (Class arg0) -> bool
|
125
|
-
|
126
|
-
def instance_variable_defined?: (Symbol | String arg0) -> bool
|
127
|
-
|
128
|
-
def instance_variable_get: (Symbol | String arg0) -> untyped
|
129
|
-
|
130
|
-
def instance_variable_set: [T] (Symbol | String arg0, T arg1) -> T
|
131
|
-
|
132
|
-
def instance_variables: () -> ::Array[Symbol]
|
133
|
-
|
134
|
-
def is_a?: (Class | Module arg0) -> bool
|
135
|
-
alias kind_of? is_a?
|
136
|
-
|
137
|
-
def method: (Symbol | String arg0) -> Method
|
138
|
-
|
139
|
-
def methods: (?bool regular) -> ::Array[Symbol]
|
140
|
-
|
141
|
-
def `nil?`: () -> FalseClass
|
142
|
-
|
143
|
-
def private_methods: (?bool all) -> ::Array[Symbol]
|
144
|
-
|
145
|
-
def protected_methods: (?bool all) -> ::Array[Symbol]
|
146
|
-
|
147
|
-
def public_method: (Symbol | String arg0) -> Method
|
148
|
-
|
149
|
-
def public_methods: (?bool all) -> ::Array[Symbol]
|
150
|
-
|
151
|
-
def `public_send`: (Symbol | String arg0, *untyped args) -> untyped
|
152
|
-
| (Symbol | String arg0, *untyped args) { (*untyped) -> untyped } -> untyped
|
153
|
-
|
154
|
-
def remove_instance_variable: (Symbol | String arg0) -> untyped
|
155
|
-
|
156
|
-
def `send`: (String | Symbol arg0, *untyped arg1) -> untyped
|
157
|
-
| (String | Symbol arg0, *untyped arg1) { (*untyped) -> untyped } -> untyped
|
158
|
-
|
159
|
-
def `singleton_class`: () -> Class
|
160
|
-
|
161
|
-
def singleton_method: (Symbol | String arg0) -> Method
|
162
|
-
|
163
|
-
def singleton_methods: (?bool all) -> ::Array[Symbol]
|
164
|
-
|
165
|
-
def taint: () -> self
|
166
|
-
alias untrust taint
|
167
|
-
|
168
|
-
def tainted?: () -> bool
|
169
|
-
alias untrusted? tainted?
|
170
|
-
|
171
|
-
def tap: () { (untyped x) -> void } -> self
|
172
|
-
|
173
|
-
def to_s: () -> String
|
174
|
-
|
175
|
-
def untaint: () -> self
|
176
|
-
alias trust untaint
|
177
|
-
|
178
96
|
# Returns `arg` as an [Array](https://ruby-doc.org/core-2.6.3/Array.html)
|
179
97
|
# .
|
180
|
-
#
|
98
|
+
#
|
181
99
|
# First tries to call `to_ary` on `arg`, then `to_a` . If `arg` does not
|
182
100
|
# respond to `to_ary` or `to_a`, returns an
|
183
101
|
# [Array](https://ruby-doc.org/core-2.6.3/Array.html) of length 1
|
184
102
|
# containing `arg` .
|
185
|
-
#
|
103
|
+
#
|
186
104
|
# If `to_ary` or `to_a` returns something other than an
|
187
105
|
# [Array](https://ruby-doc.org/core-2.6.3/Array.html), raises a
|
188
106
|
# `TypeError` .
|
189
|
-
#
|
107
|
+
#
|
190
108
|
# ```ruby
|
191
109
|
# Array(["a", "b"]) #=> ["a", "b"]
|
192
110
|
# Array(1..5) #=> [1, 2, 3, 4, 5]
|
@@ -243,7 +161,7 @@ module Kernel
|
|
243
161
|
# at the point of call. This object can be used when calling `eval` to
|
244
162
|
# execute the evaluated command in this environment. See also the
|
245
163
|
# description of class `Binding` .
|
246
|
-
#
|
164
|
+
#
|
247
165
|
# ```ruby
|
248
166
|
# def get_binding(param)
|
249
167
|
# binding
|
@@ -258,7 +176,7 @@ module Kernel
|
|
258
176
|
# to return a status code to the invoking environment. `true` and `FALSE`
|
259
177
|
# of *status* means success and failure respectively. The interpretation
|
260
178
|
# of other integer values are system dependent.
|
261
|
-
#
|
179
|
+
#
|
262
180
|
# ```ruby
|
263
181
|
# begin
|
264
182
|
# exit
|
@@ -268,25 +186,25 @@ module Kernel
|
|
268
186
|
# end
|
269
187
|
# puts "after begin block"
|
270
188
|
# ```
|
271
|
-
#
|
189
|
+
#
|
272
190
|
# *produces:*
|
273
|
-
#
|
191
|
+
#
|
274
192
|
# rescued a SystemExit exception
|
275
193
|
# after begin block
|
276
|
-
#
|
194
|
+
#
|
277
195
|
# Just prior to termination, Ruby executes any `at_exit` functions (see
|
278
196
|
# Kernel::at\_exit) and runs any object finalizers (see
|
279
197
|
# [ObjectSpace.define\_finalizer](https://ruby-doc.org/core-2.6.3/ObjectSpace.html#method-c-define_finalizer)
|
280
198
|
# ).
|
281
|
-
#
|
199
|
+
#
|
282
200
|
# ```ruby
|
283
201
|
# at_exit { puts "at_exit function" }
|
284
202
|
# ObjectSpace.define_finalizer("string", proc { puts "in finalizer" })
|
285
203
|
# exit
|
286
204
|
# ```
|
287
|
-
#
|
205
|
+
#
|
288
206
|
# *produces:*
|
289
|
-
#
|
207
|
+
#
|
290
208
|
# at_exit function
|
291
209
|
# in finalizer
|
292
210
|
def exit: () -> bot
|
@@ -323,18 +241,18 @@ module Kernel
|
|
323
241
|
def gets: (?String arg0, ?Integer arg1) -> String?
|
324
242
|
|
325
243
|
# Returns an array of the names of global variables.
|
326
|
-
#
|
244
|
+
#
|
327
245
|
# ```ruby
|
328
246
|
# global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
|
329
247
|
# ```
|
330
248
|
def global_variables: () -> ::Array[Symbol]
|
331
249
|
|
332
|
-
def load: (String filename, ?
|
250
|
+
def load: (String filename, ?boolish) -> bool
|
333
251
|
|
334
252
|
# Repeatedly executes the block.
|
335
|
-
#
|
253
|
+
#
|
336
254
|
# If no block is given, an enumerator is returned instead.
|
337
|
-
#
|
255
|
+
#
|
338
256
|
# ```ruby
|
339
257
|
# loop do
|
340
258
|
# print "Input: "
|
@@ -343,18 +261,18 @@ module Kernel
|
|
343
261
|
# # ...
|
344
262
|
# end
|
345
263
|
# ```
|
346
|
-
#
|
264
|
+
#
|
347
265
|
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html)
|
348
266
|
# raised in the block breaks the loop. In this case, loop returns the
|
349
267
|
# "result" value stored in the exception.
|
350
|
-
#
|
268
|
+
#
|
351
269
|
# ```ruby
|
352
270
|
# enum = Enumerator.new { |y|
|
353
271
|
# y << "one"
|
354
272
|
# y << "two"
|
355
273
|
# :ok
|
356
274
|
# }
|
357
|
-
#
|
275
|
+
#
|
358
276
|
# result = loop {
|
359
277
|
# puts enum.next
|
360
278
|
# } #=> :ok
|
@@ -370,16 +288,16 @@ module Kernel
|
|
370
288
|
# the output record separator ( `$\` ) is not `nil`, it will be appended
|
371
289
|
# to the output. If no arguments are given, prints `$_` . Objects that
|
372
290
|
# aren’t strings will be converted by calling their `to_s` method.
|
373
|
-
#
|
291
|
+
#
|
374
292
|
# ```ruby
|
375
293
|
# print "cat", [1,2,3], 99, "\n"
|
376
294
|
# $, = ", "
|
377
295
|
# $\ = "\n"
|
378
296
|
# print "cat", [1,2,3], 99
|
379
297
|
# ```
|
380
|
-
#
|
298
|
+
#
|
381
299
|
# *produces:*
|
382
|
-
#
|
300
|
+
#
|
383
301
|
# cat12399
|
384
302
|
# cat, 1, 2, 3, 99
|
385
303
|
def print: (*Kernel args) -> nil
|
@@ -406,35 +324,35 @@ module Kernel
|
|
406
324
|
# If called without an argument, or if `max.to_i.abs == 0`, rand returns
|
407
325
|
# a pseudo-random floating point number between 0.0 and 1.0, including 0.0
|
408
326
|
# and excluding 1.0.
|
409
|
-
#
|
327
|
+
#
|
410
328
|
# ```ruby
|
411
329
|
# rand #=> 0.2725926052826416
|
412
330
|
# ```
|
413
|
-
#
|
331
|
+
#
|
414
332
|
# When `max.abs` is greater than or equal to 1, `rand` returns a
|
415
333
|
# pseudo-random integer greater than or equal to 0 and less than
|
416
334
|
# `max.to_i.abs` .
|
417
|
-
#
|
335
|
+
#
|
418
336
|
# ```ruby
|
419
337
|
# rand(100) #=> 12
|
420
338
|
# ```
|
421
|
-
#
|
339
|
+
#
|
422
340
|
# When `max` is a [Range](https://ruby-doc.org/core-2.6.3/Range.html),
|
423
341
|
# `rand` returns a random number where range.member?(number) == true.
|
424
|
-
#
|
342
|
+
#
|
425
343
|
# Negative or floating point values for `max` are allowed, but may give
|
426
344
|
# surprising results.
|
427
|
-
#
|
345
|
+
#
|
428
346
|
# ```ruby
|
429
347
|
# rand(-100) # => 87
|
430
348
|
# rand(-0.5) # => 0.8130921818028143
|
431
349
|
# rand(1.9) # equivalent to rand(1), which is always 0
|
432
350
|
# ```
|
433
|
-
#
|
351
|
+
#
|
434
352
|
# [\#srand](Kernel.downloaded.ruby_doc#method-i-srand) may be used to
|
435
353
|
# ensure that sequences of random numbers are reproducible between
|
436
354
|
# different runs of a program.
|
437
|
-
#
|
355
|
+
#
|
438
356
|
# See also
|
439
357
|
# [Random\#rand](https://ruby-doc.org/core-2.6.3/Random.html#method-i-rand)
|
440
358
|
# .
|
@@ -466,109 +384,109 @@ module Kernel
|
|
466
384
|
|
467
385
|
# Replaces the current process by running the given external *command* ,
|
468
386
|
# which can take one of the following forms:
|
469
|
-
#
|
387
|
+
#
|
470
388
|
# - `exec(commandline)`
|
471
389
|
# command line string which is passed to the standard shell
|
472
|
-
#
|
390
|
+
#
|
473
391
|
# - `exec(cmdname, arg1, ...)`
|
474
392
|
# command name and one or more arguments (no shell)
|
475
|
-
#
|
393
|
+
#
|
476
394
|
# - `exec([cmdname, argv0], arg1, ...)`
|
477
395
|
# command name, [argv](https://ruby-doc.org/core-2.6.3/0) and zero or
|
478
396
|
# more arguments (no shell)
|
479
|
-
#
|
397
|
+
#
|
480
398
|
# In the first form, the string is taken as a command line that is subject
|
481
399
|
# to shell expansion before being executed.
|
482
|
-
#
|
400
|
+
#
|
483
401
|
# The standard shell always means `"/bin/sh"` on Unix-like systems, same
|
484
402
|
# as `ENV["RUBYSHELL"]` (or `ENV["COMSPEC"]` on Windows NT series), and
|
485
403
|
# similar.
|
486
|
-
#
|
404
|
+
#
|
487
405
|
# If the string from the first form ( `exec("command")` ) follows these
|
488
406
|
# simple rules:
|
489
|
-
#
|
407
|
+
#
|
490
408
|
# - no meta characters
|
491
|
-
#
|
409
|
+
#
|
492
410
|
# - no shell reserved word and no special built-in
|
493
|
-
#
|
411
|
+
#
|
494
412
|
# - Ruby invokes the command directly without shell
|
495
|
-
#
|
413
|
+
#
|
496
414
|
# You can force shell invocation by adding “;” to the string (because “;”
|
497
415
|
# is a meta character).
|
498
|
-
#
|
416
|
+
#
|
499
417
|
# Note that this behavior is observable by pid obtained (return value of
|
500
418
|
# spawn() and
|
501
419
|
# [IO\#pid](https://ruby-doc.org/core-2.6.3/IO.html#method-i-pid) for
|
502
420
|
# [IO.popen](https://ruby-doc.org/core-2.6.3/IO.html#method-c-popen) ) is
|
503
421
|
# the pid of the invoked command, not shell.
|
504
|
-
#
|
422
|
+
#
|
505
423
|
# In the second form ( `exec("command1", "arg1", ...)` ), the first is
|
506
424
|
# taken as a command name and the rest are passed as parameters to command
|
507
425
|
# with no shell expansion.
|
508
|
-
#
|
426
|
+
#
|
509
427
|
# In the third form ( `exec(["command", "argv0"], "arg1", ...)` ),
|
510
428
|
# starting a two-element array at the beginning of the command, the first
|
511
429
|
# element is the command to be executed, and the second argument is used
|
512
430
|
# as the `argv[0]` value, which may show up in process listings.
|
513
|
-
#
|
431
|
+
#
|
514
432
|
# In order to execute the command, one of the `exec(2)` system calls are
|
515
433
|
# used, so the running command may inherit some of the environment of the
|
516
434
|
# original program (including open file descriptors).
|
517
|
-
#
|
435
|
+
#
|
518
436
|
# This behavior is modified by the given `env` and `options` parameters.
|
519
437
|
# See ::spawn for details.
|
520
|
-
#
|
438
|
+
#
|
521
439
|
# If the command fails to execute (typically `Errno::ENOENT` when it was
|
522
440
|
# not found) a
|
523
441
|
# [SystemCallError](https://ruby-doc.org/core-2.6.3/SystemCallError.html)
|
524
442
|
# exception is raised.
|
525
|
-
#
|
443
|
+
#
|
526
444
|
# This method modifies process attributes according to given `options`
|
527
445
|
# before `exec(2)` system call. See ::spawn for more details about the
|
528
446
|
# given `options` .
|
529
|
-
#
|
447
|
+
#
|
530
448
|
# The modified attributes may be retained when `exec(2)` system call
|
531
449
|
# fails.
|
532
|
-
#
|
450
|
+
#
|
533
451
|
# For example, hard resource limits are not restorable.
|
534
|
-
#
|
452
|
+
#
|
535
453
|
# Consider to create a child process using ::spawn or
|
536
454
|
# [\#system](Kernel.downloaded.ruby_doc#method-i-system) if this is not
|
537
455
|
# acceptable.
|
538
|
-
#
|
456
|
+
#
|
539
457
|
# ```ruby
|
540
458
|
# exec "echo *" # echoes list of files in current directory
|
541
459
|
# # never get here
|
542
|
-
#
|
460
|
+
#
|
543
461
|
# exec "echo", "*" # echoes an asterisk
|
544
462
|
# # never get here
|
545
463
|
# ```
|
546
464
|
def exec: (*String args) -> bot
|
547
465
|
|
548
466
|
# Executes *command…* in a subshell. *command…* is one of following forms.
|
549
|
-
#
|
467
|
+
#
|
550
468
|
# commandline : command line string which is passed to the standard shell
|
551
469
|
# cmdname, arg1, ... : command name and one or more arguments (no shell)
|
552
470
|
# [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
|
553
|
-
#
|
471
|
+
#
|
554
472
|
# system returns `true` if the command gives zero exit status, `false` for
|
555
473
|
# non zero exit status. Returns `nil` if command execution fails. An error
|
556
474
|
# status is available in `$?` . The arguments are processed in the same
|
557
475
|
# way as for `Kernel.spawn` .
|
558
|
-
#
|
476
|
+
#
|
559
477
|
# The hash arguments, env and options, are same as `exec` and `spawn` .
|
560
478
|
# See `Kernel.spawn` for details.
|
561
|
-
#
|
479
|
+
#
|
562
480
|
# ```ruby
|
563
481
|
# system("echo *")
|
564
482
|
# system("echo", "*")
|
565
483
|
# ```
|
566
|
-
#
|
484
|
+
#
|
567
485
|
# *produces:*
|
568
|
-
#
|
486
|
+
#
|
569
487
|
# config.h main.rb
|
570
488
|
# *
|
571
|
-
#
|
489
|
+
#
|
572
490
|
# See `Kernel.exec` for the standard shell.
|
573
491
|
def system: (*String args) -> (NilClass | FalseClass | TrueClass)
|
574
492
|
end
|