steep 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -3
- data/CHANGELOG.md +25 -0
- data/Rakefile +0 -13
- data/bin/setup +0 -2
- data/bin/smoke_runner.rb +0 -1
- data/exe/steep +0 -1
- data/lib/steep.rb +12 -1
- data/lib/steep/cli.rb +16 -1
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/drivers/check.rb +1 -12
- data/lib/steep/drivers/langserver.rb +13 -462
- data/lib/steep/drivers/utils/driver_helper.rb +1 -1
- data/lib/steep/drivers/watch.rb +97 -85
- data/lib/steep/drivers/worker.rb +51 -0
- data/lib/steep/project.rb +9 -5
- data/lib/steep/project/completion_provider.rb +4 -2
- data/lib/steep/project/file.rb +2 -1
- data/lib/steep/project/hover_content.rb +6 -3
- data/lib/steep/project/options.rb +15 -0
- data/lib/steep/project/target.rb +30 -20
- data/lib/steep/server/base_worker.rb +56 -0
- data/lib/steep/server/code_worker.rb +151 -0
- data/lib/steep/server/interaction_worker.rb +281 -0
- data/lib/steep/server/master.rb +196 -0
- data/lib/steep/server/signature_worker.rb +148 -0
- data/lib/steep/server/utils.rb +36 -0
- data/lib/steep/server/worker_process.rb +62 -0
- data/lib/steep/signature/validator.rb +5 -5
- data/lib/steep/type_construction.rb +13 -19
- data/lib/steep/type_inference/constant_env.rb +2 -10
- data/lib/steep/type_inference/context.rb +1 -0
- data/lib/steep/version.rb +1 -1
- data/steep.gemspec +7 -8
- metadata +22 -142
- data/exe/rbs +0 -3
- data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
- data/vendor/ruby-signature/.gitignore +0 -12
- data/vendor/ruby-signature/.rubocop.yml +0 -15
- data/vendor/ruby-signature/BSDL +0 -22
- data/vendor/ruby-signature/COPYING +0 -56
- data/vendor/ruby-signature/Gemfile +0 -6
- data/vendor/ruby-signature/README.md +0 -93
- data/vendor/ruby-signature/Rakefile +0 -67
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
- data/vendor/ruby-signature/bin/console +0 -14
- data/vendor/ruby-signature/bin/query-rdoc +0 -103
- data/vendor/ruby-signature/bin/setup +0 -10
- data/vendor/ruby-signature/bin/sort +0 -89
- data/vendor/ruby-signature/bin/test_runner.rb +0 -16
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
- data/vendor/ruby-signature/docs/sigs.md +0 -148
- data/vendor/ruby-signature/docs/stdlib.md +0 -152
- data/vendor/ruby-signature/docs/syntax.md +0 -528
- data/vendor/ruby-signature/exe/rbs +0 -7
- data/vendor/ruby-signature/lib/rbs.rb +0 -64
- data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
- data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
- data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
- data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
- data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
- data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
- data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
- data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
- data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
- data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
- data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
- data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
- data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
- data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
- data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
- data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
- data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
- data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
- data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
- data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
- data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
- data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
- data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
- data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
- data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
- data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
- data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
- data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
- data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
- data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
- data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
- data/vendor/ruby-signature/rbs.gemspec +0 -45
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
- data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -44
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
- data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
- data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
- data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,576 +0,0 @@
|
|
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, ?untyped 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 args) -> nil
|
388
|
-
| (String arg1, *untyped args) -> nil
|
389
|
-
| -> nil
|
390
|
-
|
391
|
-
def proc: () { () -> untyped } -> Proc
|
392
|
-
|
393
|
-
def lambda: () { () -> untyped } -> Proc
|
394
|
-
|
395
|
-
def putc: (Integer arg0) -> Integer
|
396
|
-
| (String arg0) -> String
|
397
|
-
|
398
|
-
def puts: (*untyped arg0) -> NilClass
|
399
|
-
|
400
|
-
def p: [T] (T arg0) -> T
|
401
|
-
| (*untyped arg0) -> Array[untyped]
|
402
|
-
|
403
|
-
def pp: [T] (T arg0) -> T
|
404
|
-
| (*untyped arg0) -> Array[untyped]
|
405
|
-
|
406
|
-
# If called without an argument, or if `max.to_i.abs == 0`, rand returns
|
407
|
-
# a pseudo-random floating point number between 0.0 and 1.0, including 0.0
|
408
|
-
# and excluding 1.0.
|
409
|
-
#
|
410
|
-
# ```ruby
|
411
|
-
# rand #=> 0.2725926052826416
|
412
|
-
# ```
|
413
|
-
#
|
414
|
-
# When `max.abs` is greater than or equal to 1, `rand` returns a
|
415
|
-
# pseudo-random integer greater than or equal to 0 and less than
|
416
|
-
# `max.to_i.abs` .
|
417
|
-
#
|
418
|
-
# ```ruby
|
419
|
-
# rand(100) #=> 12
|
420
|
-
# ```
|
421
|
-
#
|
422
|
-
# When `max` is a [Range](https://ruby-doc.org/core-2.6.3/Range.html),
|
423
|
-
# `rand` returns a random number where range.member?(number) == true.
|
424
|
-
#
|
425
|
-
# Negative or floating point values for `max` are allowed, but may give
|
426
|
-
# surprising results.
|
427
|
-
#
|
428
|
-
# ```ruby
|
429
|
-
# rand(-100) # => 87
|
430
|
-
# rand(-0.5) # => 0.8130921818028143
|
431
|
-
# rand(1.9) # equivalent to rand(1), which is always 0
|
432
|
-
# ```
|
433
|
-
#
|
434
|
-
# [\#srand](Kernel.downloaded.ruby_doc#method-i-srand) may be used to
|
435
|
-
# ensure that sequences of random numbers are reproducible between
|
436
|
-
# different runs of a program.
|
437
|
-
#
|
438
|
-
# See also
|
439
|
-
# [Random\#rand](https://ruby-doc.org/core-2.6.3/Random.html#method-i-rand)
|
440
|
-
# .
|
441
|
-
def rand: () -> Float
|
442
|
-
| (Integer arg0) -> Integer
|
443
|
-
| (::Range[Integer] arg0) -> Integer
|
444
|
-
| (::Range[Float] arg0) -> Float
|
445
|
-
|
446
|
-
def readline: (?String arg0, ?Integer arg1) -> String
|
447
|
-
|
448
|
-
def readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
|
449
|
-
|
450
|
-
def require: (String path) -> bool
|
451
|
-
|
452
|
-
def require_relative: (String feature) -> bool
|
453
|
-
|
454
|
-
def select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
|
455
|
-
|
456
|
-
def sleep: () -> bot
|
457
|
-
| (Numeric duration) -> Integer
|
458
|
-
|
459
|
-
def syscall: (Integer num, *untyped args) -> untyped
|
460
|
-
|
461
|
-
def test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
|
462
|
-
|
463
|
-
def throw: (Object tag, ?untyped obj) -> bot
|
464
|
-
|
465
|
-
def warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
|
466
|
-
|
467
|
-
# Replaces the current process by running the given external *command* ,
|
468
|
-
# which can take one of the following forms:
|
469
|
-
#
|
470
|
-
# - `exec(commandline)`
|
471
|
-
# command line string which is passed to the standard shell
|
472
|
-
#
|
473
|
-
# - `exec(cmdname, arg1, ...)`
|
474
|
-
# command name and one or more arguments (no shell)
|
475
|
-
#
|
476
|
-
# - `exec([cmdname, argv0], arg1, ...)`
|
477
|
-
# command name, [argv](https://ruby-doc.org/core-2.6.3/0) and zero or
|
478
|
-
# more arguments (no shell)
|
479
|
-
#
|
480
|
-
# In the first form, the string is taken as a command line that is subject
|
481
|
-
# to shell expansion before being executed.
|
482
|
-
#
|
483
|
-
# The standard shell always means `"/bin/sh"` on Unix-like systems, same
|
484
|
-
# as `ENV["RUBYSHELL"]` (or `ENV["COMSPEC"]` on Windows NT series), and
|
485
|
-
# similar.
|
486
|
-
#
|
487
|
-
# If the string from the first form ( `exec("command")` ) follows these
|
488
|
-
# simple rules:
|
489
|
-
#
|
490
|
-
# - no meta characters
|
491
|
-
#
|
492
|
-
# - no shell reserved word and no special built-in
|
493
|
-
#
|
494
|
-
# - Ruby invokes the command directly without shell
|
495
|
-
#
|
496
|
-
# You can force shell invocation by adding “;” to the string (because “;”
|
497
|
-
# is a meta character).
|
498
|
-
#
|
499
|
-
# Note that this behavior is observable by pid obtained (return value of
|
500
|
-
# spawn() and
|
501
|
-
# [IO\#pid](https://ruby-doc.org/core-2.6.3/IO.html#method-i-pid) for
|
502
|
-
# [IO.popen](https://ruby-doc.org/core-2.6.3/IO.html#method-c-popen) ) is
|
503
|
-
# the pid of the invoked command, not shell.
|
504
|
-
#
|
505
|
-
# In the second form ( `exec("command1", "arg1", ...)` ), the first is
|
506
|
-
# taken as a command name and the rest are passed as parameters to command
|
507
|
-
# with no shell expansion.
|
508
|
-
#
|
509
|
-
# In the third form ( `exec(["command", "argv0"], "arg1", ...)` ),
|
510
|
-
# starting a two-element array at the beginning of the command, the first
|
511
|
-
# element is the command to be executed, and the second argument is used
|
512
|
-
# as the `argv[0]` value, which may show up in process listings.
|
513
|
-
#
|
514
|
-
# In order to execute the command, one of the `exec(2)` system calls are
|
515
|
-
# used, so the running command may inherit some of the environment of the
|
516
|
-
# original program (including open file descriptors).
|
517
|
-
#
|
518
|
-
# This behavior is modified by the given `env` and `options` parameters.
|
519
|
-
# See ::spawn for details.
|
520
|
-
#
|
521
|
-
# If the command fails to execute (typically `Errno::ENOENT` when it was
|
522
|
-
# not found) a
|
523
|
-
# [SystemCallError](https://ruby-doc.org/core-2.6.3/SystemCallError.html)
|
524
|
-
# exception is raised.
|
525
|
-
#
|
526
|
-
# This method modifies process attributes according to given `options`
|
527
|
-
# before `exec(2)` system call. See ::spawn for more details about the
|
528
|
-
# given `options` .
|
529
|
-
#
|
530
|
-
# The modified attributes may be retained when `exec(2)` system call
|
531
|
-
# fails.
|
532
|
-
#
|
533
|
-
# For example, hard resource limits are not restorable.
|
534
|
-
#
|
535
|
-
# Consider to create a child process using ::spawn or
|
536
|
-
# [\#system](Kernel.downloaded.ruby_doc#method-i-system) if this is not
|
537
|
-
# acceptable.
|
538
|
-
#
|
539
|
-
# ```ruby
|
540
|
-
# exec "echo *" # echoes list of files in current directory
|
541
|
-
# # never get here
|
542
|
-
#
|
543
|
-
# exec "echo", "*" # echoes an asterisk
|
544
|
-
# # never get here
|
545
|
-
# ```
|
546
|
-
def exec: (*String args) -> bot
|
547
|
-
|
548
|
-
# Executes *command…* in a subshell. *command…* is one of following forms.
|
549
|
-
#
|
550
|
-
# commandline : command line string which is passed to the standard shell
|
551
|
-
# cmdname, arg1, ... : command name and one or more arguments (no shell)
|
552
|
-
# [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
|
553
|
-
#
|
554
|
-
# system returns `true` if the command gives zero exit status, `false` for
|
555
|
-
# non zero exit status. Returns `nil` if command execution fails. An error
|
556
|
-
# status is available in `$?` . The arguments are processed in the same
|
557
|
-
# way as for `Kernel.spawn` .
|
558
|
-
#
|
559
|
-
# The hash arguments, env and options, are same as `exec` and `spawn` .
|
560
|
-
# See `Kernel.spawn` for details.
|
561
|
-
#
|
562
|
-
# ```ruby
|
563
|
-
# system("echo *")
|
564
|
-
# system("echo", "*")
|
565
|
-
# ```
|
566
|
-
#
|
567
|
-
# *produces:*
|
568
|
-
#
|
569
|
-
# config.h main.rb
|
570
|
-
# *
|
571
|
-
#
|
572
|
-
# See `Kernel.exec` for the standard shell.
|
573
|
-
def system: (*String args) -> (NilClass | FalseClass | TrueClass)
|
574
|
-
end
|
575
|
-
|
576
|
-
Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped
|