steep 0.11.1 → 0.12.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 +27 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.md +5 -0
- data/README.md +48 -90
- data/Rakefile +10 -6
- data/Steepfile +1 -0
- data/bin/setup +1 -0
- data/bin/smoke_runner.rb +9 -14
- data/exe/rbs +3 -0
- data/exe/ruby-signature +3 -0
- data/exe/steep +1 -0
- data/lib/steep.rb +32 -26
- data/lib/steep/annotation_parser.rb +167 -0
- data/lib/steep/ast/annotation/collection.rb +7 -7
- data/lib/steep/ast/types.rb +60 -0
- data/lib/steep/ast/types/any.rb +1 -1
- data/lib/steep/ast/types/factory.rb +535 -0
- data/lib/steep/ast/types/name.rb +3 -3
- data/lib/steep/ast/types/var.rb +1 -1
- data/lib/steep/cli.rb +56 -240
- data/lib/steep/drivers/annotations.rb +36 -19
- data/lib/steep/drivers/check.rb +55 -91
- data/lib/steep/drivers/init.rb +54 -0
- data/lib/steep/drivers/langserver.rb +241 -150
- data/lib/steep/drivers/print_project.rb +56 -0
- data/lib/steep/drivers/signature_error_printer.rb +25 -0
- data/lib/steep/drivers/trace_printer.rb +25 -0
- data/lib/steep/drivers/utils/driver_helper.rb +26 -0
- data/lib/steep/drivers/validate.rb +18 -38
- data/lib/steep/drivers/vendor.rb +46 -0
- data/lib/steep/drivers/watch.rb +78 -140
- data/lib/steep/errors.rb +22 -13
- data/lib/steep/interface/interface.rb +91 -0
- data/lib/steep/interface/method.rb +0 -4
- data/lib/steep/interface/method_type.rb +362 -2
- data/lib/steep/interface/substitution.rb +22 -0
- data/lib/steep/project.rb +25 -233
- data/lib/steep/project/dsl.rb +132 -0
- data/lib/steep/project/file.rb +93 -76
- data/lib/steep/project/file_loader.rb +63 -0
- data/lib/steep/project/options.rb +7 -0
- data/lib/steep/project/target.rb +190 -0
- data/lib/steep/signature/errors.rb +25 -77
- data/lib/steep/signature/validator.rb +122 -0
- data/lib/steep/source.rb +12 -7
- data/lib/steep/subtyping/check.rb +357 -633
- data/lib/steep/subtyping/constraints.rb +2 -2
- data/lib/steep/subtyping/trace.rb +23 -0
- data/lib/steep/type_construction.rb +509 -455
- data/lib/steep/type_inference/constant_env.rb +16 -24
- data/lib/steep/type_inference/type_env.rb +26 -18
- data/lib/steep/version.rb +1 -1
- data/sample/Steepfile +6 -0
- data/sample/lib/conference.rb +12 -0
- data/sample/sig/conference.rbs +6 -0
- data/smoke/alias/Steepfile +4 -0
- data/smoke/alias/a.rb +2 -2
- data/smoke/alias/{a.rbi → a.rbs} +1 -1
- data/smoke/and/Steepfile +4 -0
- data/smoke/array/Steepfile +4 -0
- data/smoke/array/a.rb +2 -2
- data/smoke/array/b.rb +4 -4
- data/smoke/array/c.rb +2 -2
- data/smoke/block/Steepfile +5 -0
- data/smoke/block/{a.rbi → a.rbs} +1 -1
- data/smoke/block/{c.rbi → c.rbs} +0 -0
- data/smoke/block/d.rb +6 -6
- data/smoke/case/Steepfile +4 -0
- data/smoke/case/a.rb +4 -3
- data/smoke/class/Steepfile +4 -0
- data/smoke/class/a.rb +1 -4
- data/smoke/class/a.rbs +24 -0
- data/smoke/class/h.rb +6 -2
- data/smoke/class/{h.rbi → h.rbs} +1 -2
- data/smoke/class/i.rb +1 -2
- data/smoke/class/i.rbs +9 -0
- data/smoke/const/Steepfile +4 -0
- data/smoke/dstr/Steepfile +4 -0
- data/smoke/ensure/Steepfile +4 -0
- data/smoke/ensure/a.rb +1 -1
- data/smoke/enumerator/Steepfile +4 -0
- data/smoke/enumerator/a.rb +7 -7
- data/smoke/enumerator/b.rb +6 -6
- data/smoke/extension/Steepfile +4 -0
- data/smoke/extension/{a.rbi → a.rbs} +2 -2
- data/smoke/extension/{e.rbi → e.rbs} +2 -2
- data/smoke/hash/Steepfile +4 -0
- data/smoke/hash/{a.rbi → a.rbs} +0 -0
- data/smoke/hash/b.rb +2 -2
- data/smoke/hash/c.rb +1 -1
- data/smoke/hash/e.rbs +3 -0
- data/smoke/hash/f.rb +1 -1
- data/smoke/hello/Steepfile +4 -0
- data/smoke/hello/hello.rbs +7 -0
- data/smoke/if/Steepfile +4 -0
- data/smoke/implements/Steepfile +4 -0
- data/smoke/implements/a.rbs +6 -0
- data/smoke/initialize/Steepfile +4 -0
- data/smoke/initialize/a.rbs +3 -0
- data/smoke/integer/Steepfile +4 -0
- data/smoke/integer/a.rb +5 -3
- data/smoke/interface/Steepfile +4 -0
- data/smoke/interface/{a.rbi → a.rbs} +0 -0
- data/smoke/kwbegin/Steepfile +4 -0
- data/smoke/lambda/Steepfile +4 -0
- data/smoke/lambda/a.rb +9 -2
- data/smoke/literal/Steepfile +4 -0
- data/smoke/literal/{literal_methods.rbi → literal_methods.rbs} +0 -0
- data/smoke/map/Steepfile +4 -0
- data/smoke/map/a.rb +1 -1
- data/smoke/method/Steepfile +4 -0
- data/smoke/method/{a.rbi → a.rbs} +0 -0
- data/smoke/method/b.rb +1 -4
- data/smoke/method/d.rb +1 -0
- data/smoke/method/d.rbs +3 -0
- data/smoke/module/Steepfile +4 -0
- data/smoke/module/a.rb +1 -1
- data/smoke/module/a.rbs +16 -0
- data/smoke/module/c.rb +1 -1
- data/smoke/regexp/Steepfile +4 -0
- data/smoke/regexp/a.rb +2 -2
- data/smoke/regexp/b.rb +16 -16
- data/smoke/regression/Steepfile +5 -0
- data/smoke/regression/array.rb +2 -2
- data/smoke/regression/hash.rb +2 -2
- data/smoke/regression/poly_new.rb +2 -0
- data/smoke/regression/poly_new.rbs +4 -0
- data/smoke/regression/set_divide.rb +2 -2
- data/smoke/rescue/Steepfile +4 -0
- data/smoke/rescue/a.rb +1 -1
- data/smoke/self/Steepfile +4 -0
- data/smoke/self/a.rbs +4 -0
- data/smoke/skip/Steepfile +4 -0
- data/smoke/stdout/Steepfile +4 -0
- data/smoke/stdout/{a.rbi → a.rbs} +1 -1
- data/smoke/super/Steepfile +4 -0
- data/smoke/super/a.rbs +10 -0
- data/smoke/type_case/Steepfile +4 -0
- data/smoke/type_case/a.rb +1 -1
- data/smoke/yield/Steepfile +4 -0
- data/smoke/yield/a.rb +2 -2
- data/steep.gemspec +14 -7
- data/vendor/ruby-signature/.github/workflows/ruby.yml +27 -0
- data/vendor/ruby-signature/.gitignore +12 -0
- data/vendor/ruby-signature/.rubocop.yml +15 -0
- data/vendor/ruby-signature/BSDL +22 -0
- data/vendor/ruby-signature/COPYING +56 -0
- data/vendor/ruby-signature/Gemfile +6 -0
- data/vendor/ruby-signature/README.md +93 -0
- data/vendor/ruby-signature/Rakefile +66 -0
- data/vendor/ruby-signature/bin/annotate-with-rdoc +156 -0
- data/vendor/ruby-signature/bin/console +14 -0
- data/vendor/ruby-signature/bin/query-rdoc +103 -0
- data/vendor/ruby-signature/bin/setup +10 -0
- data/vendor/ruby-signature/bin/sort +88 -0
- data/vendor/ruby-signature/bin/test_runner.rb +17 -0
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +97 -0
- data/vendor/ruby-signature/docs/sigs.md +148 -0
- data/vendor/ruby-signature/docs/stdlib.md +152 -0
- data/vendor/ruby-signature/docs/syntax.md +528 -0
- data/vendor/ruby-signature/exe/rbs +3 -0
- data/vendor/ruby-signature/exe/ruby-signature +7 -0
- data/vendor/ruby-signature/lib/ruby/signature.rb +64 -0
- data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +29 -0
- data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +29 -0
- data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +391 -0
- data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +364 -0
- data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +52 -0
- data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +54 -0
- data/vendor/ruby-signature/lib/ruby/signature/cli.rb +534 -0
- data/vendor/ruby-signature/lib/ruby/signature/constant.rb +28 -0
- data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +152 -0
- data/vendor/ruby-signature/lib/ruby/signature/definition.rb +172 -0
- data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +921 -0
- data/vendor/ruby-signature/lib/ruby/signature/environment.rb +283 -0
- data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +138 -0
- data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +126 -0
- data/vendor/ruby-signature/lib/ruby/signature/errors.rb +189 -0
- data/vendor/ruby-signature/lib/ruby/signature/location.rb +104 -0
- data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +125 -0
- data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +93 -0
- data/vendor/ruby-signature/lib/ruby/signature/parser.y +1343 -0
- data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +441 -0
- data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +579 -0
- data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +383 -0
- data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +48 -0
- data/vendor/ruby-signature/lib/ruby/signature/test.rb +28 -0
- data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +63 -0
- data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +290 -0
- data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +58 -0
- data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +324 -0
- data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +185 -0
- data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +256 -0
- data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +72 -0
- data/vendor/ruby-signature/lib/ruby/signature/types.rb +932 -0
- data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +140 -0
- data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +49 -0
- data/vendor/ruby-signature/lib/ruby/signature/version.rb +5 -0
- data/vendor/ruby-signature/lib/ruby/signature/writer.rb +271 -0
- data/vendor/ruby-signature/ruby-signature.gemspec +45 -0
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +3 -0
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +15 -0
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +1997 -0
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +280 -0
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +177 -0
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +35 -0
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +145 -0
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +116 -0
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +400 -0
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +37 -0
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +5 -0
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +2 -0
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +419 -0
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +606 -0
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +404 -0
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +260 -0
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +781 -0
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +582 -0
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +193 -0
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +40 -0
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +68 -0
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +12 -0
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +476 -0
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +59 -0
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +696 -0
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +121 -0
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +1029 -0
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +710 -0
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +683 -0
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +574 -0
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +135 -0
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +141 -0
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +66 -0
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +182 -0
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +248 -0
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +82 -0
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +409 -0
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +824 -0
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +426 -0
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +354 -0
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +93 -0
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +226 -0
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +424 -0
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +10 -0
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +131 -0
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +14 -0
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +55 -0
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +770 -0
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +13 -0
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +40 -0
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +230 -0
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +1112 -0
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +23 -0
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +739 -0
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +91 -0
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +46 -0
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +159 -0
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +17 -0
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +18 -0
- data/vendor/ruby-signature/stdlib/find/find.rbs +44 -0
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +21 -0
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +23 -0
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +188 -0
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +9 -0
- data/vendor/ruby-signature/stdlib/set/set.rbs +77 -0
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +53 -0
- metadata +244 -54
- data/.travis.yml +0 -7
- data/lib/steep/ast/signature/alias.rb +0 -19
- data/lib/steep/ast/signature/class.rb +0 -33
- data/lib/steep/ast/signature/const.rb +0 -17
- data/lib/steep/ast/signature/env.rb +0 -138
- data/lib/steep/ast/signature/extension.rb +0 -21
- data/lib/steep/ast/signature/gvar.rb +0 -17
- data/lib/steep/ast/signature/interface.rb +0 -31
- data/lib/steep/ast/signature/members.rb +0 -115
- data/lib/steep/ast/signature/module.rb +0 -21
- data/lib/steep/drivers/print_interface.rb +0 -94
- data/lib/steep/drivers/scaffold.rb +0 -321
- data/lib/steep/drivers/utils/each_signature.rb +0 -31
- data/lib/steep/interface/abstract.rb +0 -68
- data/lib/steep/interface/builder.rb +0 -637
- data/lib/steep/interface/instantiated.rb +0 -163
- data/lib/steep/interface/ivar_chain.rb +0 -26
- data/lib/steep/parser.y +0 -1278
- data/lib/steep/project/listener.rb +0 -53
- data/smoke/class/a.rbi +0 -24
- data/smoke/class/d.rb +0 -9
- data/smoke/class/e.rb +0 -12
- data/smoke/class/i.rbi +0 -9
- data/smoke/hash/e.rbi +0 -3
- data/smoke/hello/hello.rbi +0 -7
- data/smoke/implements/a.rbi +0 -6
- data/smoke/initialize/a.rbi +0 -3
- data/smoke/module/a.rbi +0 -16
- data/smoke/self/a.rbi +0 -4
- data/smoke/super/a.rbi +0 -10
- data/stdlib/builtin.rbi +0 -787
@@ -0,0 +1,574 @@
|
|
1
|
+
# The [Kernel](Kernel) module is included by class
|
2
|
+
# [Object](https://ruby-doc.org/core-2.6.3/Object.html), so its methods
|
3
|
+
# are available in every Ruby object.
|
4
|
+
#
|
5
|
+
# The [Kernel](Kernel) instance methods are documented
|
6
|
+
# in class [Object](https://ruby-doc.org/core-2.6.3/Object.html) while the
|
7
|
+
# module methods are documented here. These methods are called without a
|
8
|
+
# receiver and thus can be called in functional form:
|
9
|
+
#
|
10
|
+
# ```ruby
|
11
|
+
# sprintf "%.1f", 1.234 #=> "1.2"
|
12
|
+
# ```
|
13
|
+
module Kernel
|
14
|
+
def caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
|
15
|
+
| (?::Range[Integer] start_or_range) -> ::Array[String]?
|
16
|
+
| () -> ::Array[String]
|
17
|
+
|
18
|
+
def caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
|
19
|
+
| (?::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
|
20
|
+
|
21
|
+
def catch: [T] (T tag) { (T tag) -> untyped } -> untyped
|
22
|
+
| () { (Object tag) -> untyped } -> untyped
|
23
|
+
|
24
|
+
# In a perfect world this should be:
|
25
|
+
#
|
26
|
+
# returns(T.class_of(T.self_type))
|
27
|
+
#
|
28
|
+
# but that doesn't work (yet). Even making it:
|
29
|
+
#
|
30
|
+
# returns(Class)
|
31
|
+
#
|
32
|
+
# is very surprising since users expect their methods to be present.
|
33
|
+
# So we settle for untyped.
|
34
|
+
def `class`: () -> untyped
|
35
|
+
|
36
|
+
def define_singleton_method: (Symbol | String symbol, ?Proc | Method | UnboundMethod method) -> Symbol
|
37
|
+
| (Symbol | String symbol) { () -> untyped } -> Symbol
|
38
|
+
|
39
|
+
def eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
|
40
|
+
|
41
|
+
# Returns `true` if `yield` would execute a block in the current context.
|
42
|
+
# The `iterator?` form is mildly deprecated.
|
43
|
+
#
|
44
|
+
# ```ruby
|
45
|
+
# def try
|
46
|
+
# if block_given?
|
47
|
+
# yield
|
48
|
+
# else
|
49
|
+
# "no block"
|
50
|
+
# end
|
51
|
+
# end
|
52
|
+
# try #=> "no block"
|
53
|
+
# try { "hello" } #=> "hello"
|
54
|
+
# try do "hello" end #=> "hello"
|
55
|
+
# ```
|
56
|
+
def iterator?: () -> bool
|
57
|
+
alias block_given? iterator?
|
58
|
+
|
59
|
+
# Returns the names of the current local variables.
|
60
|
+
#
|
61
|
+
# ```ruby
|
62
|
+
# fred = 1
|
63
|
+
# for i in 1..10
|
64
|
+
# # ...
|
65
|
+
# end
|
66
|
+
# local_variables #=> [:fred, :i]
|
67
|
+
# ```
|
68
|
+
def local_variables: () -> ::Array[Symbol]
|
69
|
+
|
70
|
+
def srand: (?Numeric number) -> Numeric
|
71
|
+
|
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
|
+
# Creates a subprocess. If a block is specified, that block is run in the
|
95
|
+
# subprocess, and the subprocess terminates with a status of zero.
|
96
|
+
# Otherwise, the `fork` call returns twice, once in the parent, returning
|
97
|
+
# the process ID of the child, and once in the child, returning *nil* .
|
98
|
+
# The child process can exit using `Kernel.exit!` to avoid running any
|
99
|
+
# `at_exit` functions. The parent process should use `Process.wait` to
|
100
|
+
# collect the termination statuses of its children or use `Process.detach`
|
101
|
+
# to register disinterest in their status; otherwise, the operating system
|
102
|
+
# may accumulate zombie processes.
|
103
|
+
#
|
104
|
+
# The thread calling fork is the only thread in the created child process.
|
105
|
+
# fork doesn’t copy other threads.
|
106
|
+
#
|
107
|
+
# If fork is not usable, Process.respond\_to?(:fork) returns false.
|
108
|
+
#
|
109
|
+
# Note that fork(2) is not available on some platforms like Windows and
|
110
|
+
# NetBSD 4. Therefore you should use spawn() instead of fork().
|
111
|
+
def fork: () -> Integer?
|
112
|
+
| () { () -> untyped } -> Integer?
|
113
|
+
|
114
|
+
def freeze: () -> self
|
115
|
+
|
116
|
+
def frozen?: () -> bool
|
117
|
+
|
118
|
+
def hash: () -> Integer
|
119
|
+
|
120
|
+
def initialize_copy: (self object) -> self
|
121
|
+
|
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
|
+
# Returns `arg` as an [Array](https://ruby-doc.org/core-2.6.3/Array.html)
|
179
|
+
# .
|
180
|
+
#
|
181
|
+
# First tries to call `to_ary` on `arg`, then `to_a` . If `arg` does not
|
182
|
+
# respond to `to_ary` or `to_a`, returns an
|
183
|
+
# [Array](https://ruby-doc.org/core-2.6.3/Array.html) of length 1
|
184
|
+
# containing `arg` .
|
185
|
+
#
|
186
|
+
# If `to_ary` or `to_a` returns something other than an
|
187
|
+
# [Array](https://ruby-doc.org/core-2.6.3/Array.html), raises a
|
188
|
+
# `TypeError` .
|
189
|
+
#
|
190
|
+
# ```ruby
|
191
|
+
# Array(["a", "b"]) #=> ["a", "b"]
|
192
|
+
# Array(1..5) #=> [1, 2, 3, 4, 5]
|
193
|
+
# Array(key: :value) #=> [[:key, :value]]
|
194
|
+
# Array(nil) #=> []
|
195
|
+
# Array(1) #=> [1]
|
196
|
+
# ```
|
197
|
+
def Array: (NilClass x) -> [ ]
|
198
|
+
| [T] (::Array[T] x) -> ::Array[T]
|
199
|
+
| [T] (::Range[T] x) -> ::Array[T]
|
200
|
+
| [K, V] (::Hash[K, V] x) -> ::Array[[K, V]]
|
201
|
+
| [T] (T x) -> ::Array[T]
|
202
|
+
|
203
|
+
def Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
|
204
|
+
|
205
|
+
def Float: (Numeric | String x, ?exception: bool exception) -> Float
|
206
|
+
|
207
|
+
def Hash: [K, V] (Object x) -> ::Hash[K, V]
|
208
|
+
|
209
|
+
def Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
|
210
|
+
| (String arg, ?Integer base, ?exception: bool exception) -> Integer
|
211
|
+
|
212
|
+
def Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
|
213
|
+
|
214
|
+
def String: (Object x) -> String
|
215
|
+
|
216
|
+
# Returns the called name of the current method as a
|
217
|
+
# [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
|
218
|
+
# outside of a method, it returns `nil` .
|
219
|
+
def __callee__: () -> Symbol?
|
220
|
+
|
221
|
+
# Returns the canonicalized absolute path of the directory of the file
|
222
|
+
# from which this method is called. It means symlinks in the path is
|
223
|
+
# resolved. If `__FILE__` is `nil`, it returns `nil` . The return value
|
224
|
+
# equals to `File.dirname(File.realpath(__FILE__))` .
|
225
|
+
def __dir__: () -> String?
|
226
|
+
|
227
|
+
# Returns the name at the definition of the current method as a
|
228
|
+
# [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
|
229
|
+
# outside of a method, it returns `nil` .
|
230
|
+
def __method__: () -> Symbol?
|
231
|
+
|
232
|
+
def `: (String arg0) -> String
|
233
|
+
|
234
|
+
def abort: (?String msg) -> bot
|
235
|
+
|
236
|
+
def at_exit: () { () -> untyped } -> Proc
|
237
|
+
|
238
|
+
def autoload: (String | Symbol _module, String filename) -> NilClass
|
239
|
+
|
240
|
+
def autoload?: (Symbol | String name) -> String?
|
241
|
+
|
242
|
+
# Returns a `Binding` object, describing the variable and method bindings
|
243
|
+
# at the point of call. This object can be used when calling `eval` to
|
244
|
+
# execute the evaluated command in this environment. See also the
|
245
|
+
# description of class `Binding` .
|
246
|
+
#
|
247
|
+
# ```ruby
|
248
|
+
# def get_binding(param)
|
249
|
+
# binding
|
250
|
+
# end
|
251
|
+
# b = get_binding("hello")
|
252
|
+
# eval("param", b) #=> "hello"
|
253
|
+
# ```
|
254
|
+
def binding: () -> Binding
|
255
|
+
|
256
|
+
# Initiates the termination of the Ruby script by raising the `SystemExit`
|
257
|
+
# exception. This exception may be caught. The optional parameter is used
|
258
|
+
# to return a status code to the invoking environment. `true` and `FALSE`
|
259
|
+
# of *status* means success and failure respectively. The interpretation
|
260
|
+
# of other integer values are system dependent.
|
261
|
+
#
|
262
|
+
# ```ruby
|
263
|
+
# begin
|
264
|
+
# exit
|
265
|
+
# puts "never get here"
|
266
|
+
# rescue SystemExit
|
267
|
+
# puts "rescued a SystemExit exception"
|
268
|
+
# end
|
269
|
+
# puts "after begin block"
|
270
|
+
# ```
|
271
|
+
#
|
272
|
+
# *produces:*
|
273
|
+
#
|
274
|
+
# rescued a SystemExit exception
|
275
|
+
# after begin block
|
276
|
+
#
|
277
|
+
# Just prior to termination, Ruby executes any `at_exit` functions (see
|
278
|
+
# Kernel::at\_exit) and runs any object finalizers (see
|
279
|
+
# [ObjectSpace.define\_finalizer](https://ruby-doc.org/core-2.6.3/ObjectSpace.html#method-c-define_finalizer)
|
280
|
+
# ).
|
281
|
+
#
|
282
|
+
# ```ruby
|
283
|
+
# at_exit { puts "at_exit function" }
|
284
|
+
# ObjectSpace.define_finalizer("string", proc { puts "in finalizer" })
|
285
|
+
# exit
|
286
|
+
# ```
|
287
|
+
#
|
288
|
+
# *produces:*
|
289
|
+
#
|
290
|
+
# at_exit function
|
291
|
+
# in finalizer
|
292
|
+
def exit: () -> bot
|
293
|
+
| (?Integer | TrueClass | FalseClass status) -> bot
|
294
|
+
|
295
|
+
def exit!: (Integer | TrueClass | FalseClass status) -> bot
|
296
|
+
|
297
|
+
# With no arguments, raises the exception in `$!` or raises a
|
298
|
+
# `RuntimeError` if `$!` is `nil` . With a single `String` argument,
|
299
|
+
# raises a `RuntimeError` with the string as a message. Otherwise, the
|
300
|
+
# first parameter should be the name of an `Exception` class (or an object
|
301
|
+
# that returns an `Exception` object when sent an `exception` message).
|
302
|
+
# The optional second parameter sets the message associated with the
|
303
|
+
# exception, and the third parameter is an array of callback information.
|
304
|
+
# Exceptions are caught by the `rescue` clause of `begin...end` blocks.
|
305
|
+
#
|
306
|
+
# ```ruby
|
307
|
+
# raise "Failed to create socket"
|
308
|
+
# raise ArgumentError, "No parameters", caller
|
309
|
+
# ```
|
310
|
+
#
|
311
|
+
# The `cause` of the generated exception is automatically set to the
|
312
|
+
# “current” exception ( `$!` ) if any. An alternative value, either an
|
313
|
+
# `Exception` object or `nil`, can be specified via the `:cause`
|
314
|
+
# argument.
|
315
|
+
def fail: () -> bot
|
316
|
+
| (String arg0) -> bot
|
317
|
+
| (?Exception arg0, ?String arg1, ?::Array[String] arg2) -> bot
|
318
|
+
alias raise fail
|
319
|
+
|
320
|
+
def format: (String format, *untyped args) -> String
|
321
|
+
alias sprintf format
|
322
|
+
|
323
|
+
def gets: (?String arg0, ?Integer arg1) -> String?
|
324
|
+
|
325
|
+
# Returns an array of the names of global variables.
|
326
|
+
#
|
327
|
+
# ```ruby
|
328
|
+
# global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
|
329
|
+
# ```
|
330
|
+
def global_variables: () -> ::Array[Symbol]
|
331
|
+
|
332
|
+
def load: (String filename, ?bool arg0) -> bool
|
333
|
+
|
334
|
+
# Repeatedly executes the block.
|
335
|
+
#
|
336
|
+
# If no block is given, an enumerator is returned instead.
|
337
|
+
#
|
338
|
+
# ```ruby
|
339
|
+
# loop do
|
340
|
+
# print "Input: "
|
341
|
+
# line = gets
|
342
|
+
# break if !line or line =~ /^qQ/
|
343
|
+
# # ...
|
344
|
+
# end
|
345
|
+
# ```
|
346
|
+
#
|
347
|
+
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html)
|
348
|
+
# raised in the block breaks the loop. In this case, loop returns the
|
349
|
+
# "result" value stored in the exception.
|
350
|
+
#
|
351
|
+
# ```ruby
|
352
|
+
# enum = Enumerator.new { |y|
|
353
|
+
# y << "one"
|
354
|
+
# y << "two"
|
355
|
+
# :ok
|
356
|
+
# }
|
357
|
+
#
|
358
|
+
# result = loop {
|
359
|
+
# puts enum.next
|
360
|
+
# } #=> :ok
|
361
|
+
# ```
|
362
|
+
def loop: () { (nil) -> untyped } -> bot
|
363
|
+
| () -> ::Enumerator[nil, bot]
|
364
|
+
|
365
|
+
def open: (String name, ?String mode, ?Integer perm) -> IO?
|
366
|
+
| [T] (String name, ?String mode, ?Integer perm) { (IO) -> T } -> T
|
367
|
+
|
368
|
+
# Prints each object in turn to `$stdout` . If the output field separator
|
369
|
+
# ( `$,` ) is not `nil`, its contents will appear between each field. If
|
370
|
+
# the output record separator ( `$\` ) is not `nil`, it will be appended
|
371
|
+
# to the output. If no arguments are given, prints `$_` . Objects that
|
372
|
+
# aren’t strings will be converted by calling their `to_s` method.
|
373
|
+
#
|
374
|
+
# ```ruby
|
375
|
+
# print "cat", [1,2,3], 99, "\n"
|
376
|
+
# $, = ", "
|
377
|
+
# $\ = "\n"
|
378
|
+
# print "cat", [1,2,3], 99
|
379
|
+
# ```
|
380
|
+
#
|
381
|
+
# *produces:*
|
382
|
+
#
|
383
|
+
# cat12399
|
384
|
+
# cat, 1, 2, 3, 99
|
385
|
+
def print: (*Kernel args) -> nil
|
386
|
+
|
387
|
+
def printf: (?IO arg0, ?String arg1, *untyped arg2) -> nil
|
388
|
+
|
389
|
+
def proc: () { () -> untyped } -> Proc
|
390
|
+
|
391
|
+
def lambda: () { () -> untyped } -> Proc
|
392
|
+
|
393
|
+
def putc: (Integer arg0) -> Integer
|
394
|
+
| (String arg0) -> String
|
395
|
+
|
396
|
+
def puts: (*untyped arg0) -> NilClass
|
397
|
+
|
398
|
+
def p: [T] (T arg0) -> T
|
399
|
+
| (*untyped arg0) -> Array[untyped]
|
400
|
+
|
401
|
+
def pp: [T] (T arg0) -> T
|
402
|
+
| (*untyped arg0) -> Array[untyped]
|
403
|
+
|
404
|
+
# If called without an argument, or if `max.to_i.abs == 0`, rand returns
|
405
|
+
# a pseudo-random floating point number between 0.0 and 1.0, including 0.0
|
406
|
+
# and excluding 1.0.
|
407
|
+
#
|
408
|
+
# ```ruby
|
409
|
+
# rand #=> 0.2725926052826416
|
410
|
+
# ```
|
411
|
+
#
|
412
|
+
# When `max.abs` is greater than or equal to 1, `rand` returns a
|
413
|
+
# pseudo-random integer greater than or equal to 0 and less than
|
414
|
+
# `max.to_i.abs` .
|
415
|
+
#
|
416
|
+
# ```ruby
|
417
|
+
# rand(100) #=> 12
|
418
|
+
# ```
|
419
|
+
#
|
420
|
+
# When `max` is a [Range](https://ruby-doc.org/core-2.6.3/Range.html),
|
421
|
+
# `rand` returns a random number where range.member?(number) == true.
|
422
|
+
#
|
423
|
+
# Negative or floating point values for `max` are allowed, but may give
|
424
|
+
# surprising results.
|
425
|
+
#
|
426
|
+
# ```ruby
|
427
|
+
# rand(-100) # => 87
|
428
|
+
# rand(-0.5) # => 0.8130921818028143
|
429
|
+
# rand(1.9) # equivalent to rand(1), which is always 0
|
430
|
+
# ```
|
431
|
+
#
|
432
|
+
# [\#srand](Kernel.downloaded.ruby_doc#method-i-srand) may be used to
|
433
|
+
# ensure that sequences of random numbers are reproducible between
|
434
|
+
# different runs of a program.
|
435
|
+
#
|
436
|
+
# See also
|
437
|
+
# [Random\#rand](https://ruby-doc.org/core-2.6.3/Random.html#method-i-rand)
|
438
|
+
# .
|
439
|
+
def rand: () -> Float
|
440
|
+
| (Integer arg0) -> Integer
|
441
|
+
| (::Range[Integer] arg0) -> Integer
|
442
|
+
| (::Range[Float] arg0) -> Float
|
443
|
+
|
444
|
+
def readline: (?String arg0, ?Integer arg1) -> String
|
445
|
+
|
446
|
+
def readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
|
447
|
+
|
448
|
+
def require: (String path) -> bool
|
449
|
+
|
450
|
+
def require_relative: (String feature) -> bool
|
451
|
+
|
452
|
+
def select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
|
453
|
+
|
454
|
+
def sleep: () -> bot
|
455
|
+
| (Numeric duration) -> Integer
|
456
|
+
|
457
|
+
def syscall: (Integer num, *untyped args) -> untyped
|
458
|
+
|
459
|
+
def test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
|
460
|
+
|
461
|
+
def throw: (Object tag, ?untyped obj) -> bot
|
462
|
+
|
463
|
+
def warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
|
464
|
+
|
465
|
+
# Replaces the current process by running the given external *command* ,
|
466
|
+
# which can take one of the following forms:
|
467
|
+
#
|
468
|
+
# - `exec(commandline)`
|
469
|
+
# command line string which is passed to the standard shell
|
470
|
+
#
|
471
|
+
# - `exec(cmdname, arg1, ...)`
|
472
|
+
# command name and one or more arguments (no shell)
|
473
|
+
#
|
474
|
+
# - `exec([cmdname, argv0], arg1, ...)`
|
475
|
+
# command name, [argv](https://ruby-doc.org/core-2.6.3/0) and zero or
|
476
|
+
# more arguments (no shell)
|
477
|
+
#
|
478
|
+
# In the first form, the string is taken as a command line that is subject
|
479
|
+
# to shell expansion before being executed.
|
480
|
+
#
|
481
|
+
# The standard shell always means `"/bin/sh"` on Unix-like systems, same
|
482
|
+
# as `ENV["RUBYSHELL"]` (or `ENV["COMSPEC"]` on Windows NT series), and
|
483
|
+
# similar.
|
484
|
+
#
|
485
|
+
# If the string from the first form ( `exec("command")` ) follows these
|
486
|
+
# simple rules:
|
487
|
+
#
|
488
|
+
# - no meta characters
|
489
|
+
#
|
490
|
+
# - no shell reserved word and no special built-in
|
491
|
+
#
|
492
|
+
# - Ruby invokes the command directly without shell
|
493
|
+
#
|
494
|
+
# You can force shell invocation by adding “;” to the string (because “;”
|
495
|
+
# is a meta character).
|
496
|
+
#
|
497
|
+
# Note that this behavior is observable by pid obtained (return value of
|
498
|
+
# spawn() and
|
499
|
+
# [IO\#pid](https://ruby-doc.org/core-2.6.3/IO.html#method-i-pid) for
|
500
|
+
# [IO.popen](https://ruby-doc.org/core-2.6.3/IO.html#method-c-popen) ) is
|
501
|
+
# the pid of the invoked command, not shell.
|
502
|
+
#
|
503
|
+
# In the second form ( `exec("command1", "arg1", ...)` ), the first is
|
504
|
+
# taken as a command name and the rest are passed as parameters to command
|
505
|
+
# with no shell expansion.
|
506
|
+
#
|
507
|
+
# In the third form ( `exec(["command", "argv0"], "arg1", ...)` ),
|
508
|
+
# starting a two-element array at the beginning of the command, the first
|
509
|
+
# element is the command to be executed, and the second argument is used
|
510
|
+
# as the `argv[0]` value, which may show up in process listings.
|
511
|
+
#
|
512
|
+
# In order to execute the command, one of the `exec(2)` system calls are
|
513
|
+
# used, so the running command may inherit some of the environment of the
|
514
|
+
# original program (including open file descriptors).
|
515
|
+
#
|
516
|
+
# This behavior is modified by the given `env` and `options` parameters.
|
517
|
+
# See ::spawn for details.
|
518
|
+
#
|
519
|
+
# If the command fails to execute (typically `Errno::ENOENT` when it was
|
520
|
+
# not found) a
|
521
|
+
# [SystemCallError](https://ruby-doc.org/core-2.6.3/SystemCallError.html)
|
522
|
+
# exception is raised.
|
523
|
+
#
|
524
|
+
# This method modifies process attributes according to given `options`
|
525
|
+
# before `exec(2)` system call. See ::spawn for more details about the
|
526
|
+
# given `options` .
|
527
|
+
#
|
528
|
+
# The modified attributes may be retained when `exec(2)` system call
|
529
|
+
# fails.
|
530
|
+
#
|
531
|
+
# For example, hard resource limits are not restorable.
|
532
|
+
#
|
533
|
+
# Consider to create a child process using ::spawn or
|
534
|
+
# [\#system](Kernel.downloaded.ruby_doc#method-i-system) if this is not
|
535
|
+
# acceptable.
|
536
|
+
#
|
537
|
+
# ```ruby
|
538
|
+
# exec "echo *" # echoes list of files in current directory
|
539
|
+
# # never get here
|
540
|
+
#
|
541
|
+
# exec "echo", "*" # echoes an asterisk
|
542
|
+
# # never get here
|
543
|
+
# ```
|
544
|
+
def exec: (*String args) -> bot
|
545
|
+
|
546
|
+
# Executes *command…* in a subshell. *command…* is one of following forms.
|
547
|
+
#
|
548
|
+
# commandline : command line string which is passed to the standard shell
|
549
|
+
# cmdname, arg1, ... : command name and one or more arguments (no shell)
|
550
|
+
# [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
|
551
|
+
#
|
552
|
+
# system returns `true` if the command gives zero exit status, `false` for
|
553
|
+
# non zero exit status. Returns `nil` if command execution fails. An error
|
554
|
+
# status is available in `$?` . The arguments are processed in the same
|
555
|
+
# way as for `Kernel.spawn` .
|
556
|
+
#
|
557
|
+
# The hash arguments, env and options, are same as `exec` and `spawn` .
|
558
|
+
# See `Kernel.spawn` for details.
|
559
|
+
#
|
560
|
+
# ```ruby
|
561
|
+
# system("echo *")
|
562
|
+
# system("echo", "*")
|
563
|
+
# ```
|
564
|
+
#
|
565
|
+
# *produces:*
|
566
|
+
#
|
567
|
+
# config.h main.rb
|
568
|
+
# *
|
569
|
+
#
|
570
|
+
# See `Kernel.exec` for the standard shell.
|
571
|
+
def system: (*String args) -> (NilClass | FalseClass | TrueClass)
|
572
|
+
end
|
573
|
+
|
574
|
+
Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped
|