rbs 4.0.0.dev.4 → 4.1.0.pre.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/.clang-format +1 -0
- data/.github/dependabot.yml +16 -14
- data/.github/workflows/bundle-update.yml +63 -0
- data/.github/workflows/c-check.yml +21 -11
- data/.github/workflows/comments.yml +5 -3
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/jruby.yml +67 -0
- data/.github/workflows/milestone.yml +83 -0
- data/.github/workflows/ruby.yml +63 -24
- data/.github/workflows/rust.yml +184 -0
- data/.github/workflows/truffleruby.yml +54 -0
- data/.github/workflows/typecheck.yml +5 -2
- data/.github/workflows/wasm.yml +53 -0
- data/.github/workflows/windows.yml +8 -2
- data/.gitignore +11 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +357 -0
- data/README.md +4 -4
- data/Rakefile +365 -33
- data/Steepfile +8 -0
- data/config.yml +450 -24
- data/core/array.rbs +443 -363
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +9 -8
- data/core/class.rbs +11 -8
- data/core/comparable.rbs +55 -34
- data/core/complex.rbs +104 -78
- data/core/dir.rbs +61 -49
- data/core/encoding.rbs +12 -15
- data/core/enumerable.rbs +288 -196
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator/product.rbs +5 -5
- data/core/enumerator.rbs +91 -28
- data/core/errno.rbs +11 -2
- data/core/errors.rbs +58 -29
- data/core/exception.rbs +13 -13
- data/core/fiber.rbs +74 -54
- data/core/file.rbs +260 -1151
- data/core/file_constants.rbs +463 -0
- data/core/file_stat.rbs +534 -0
- data/core/file_test.rbs +3 -3
- data/core/float.rbs +257 -92
- data/core/gc.rbs +425 -281
- data/core/hash.rbs +1151 -829
- data/core/integer.rbs +156 -195
- data/core/io/buffer.rbs +53 -42
- data/core/io/wait.rbs +13 -35
- data/core/io.rbs +216 -150
- data/core/kernel.rbs +239 -163
- data/core/marshal.rbs +4 -4
- data/core/match_data.rbs +15 -13
- data/core/math.rbs +107 -66
- data/core/method.rbs +69 -33
- data/core/module.rbs +302 -150
- data/core/nil_class.rbs +7 -6
- data/core/numeric.rbs +77 -63
- data/core/object.rbs +9 -11
- data/core/object_space/weak_key_map.rbs +7 -7
- data/core/object_space.rbs +30 -23
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +95 -58
- data/core/process.rbs +222 -202
- data/core/ractor.rbs +371 -515
- data/core/random.rbs +21 -3
- data/core/range.rbs +181 -79
- data/core/rational.rbs +60 -89
- data/core/rbs/ops.rbs +154 -0
- data/core/rbs/unnamed/argf.rbs +63 -56
- data/core/rbs/unnamed/env_class.rbs +19 -14
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +11 -118
- data/core/regexp.rbs +258 -214
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +78 -34
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +4 -71
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +16 -82
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +493 -363
- data/core/signal.rbs +26 -16
- data/core/string.rbs +3234 -1285
- data/core/struct.rbs +43 -42
- data/core/symbol.rbs +41 -34
- data/core/thread.rbs +141 -73
- data/core/time.rbs +81 -50
- data/core/trace_point.rbs +41 -35
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +24 -16
- data/core/warning.rbs +7 -7
- data/docs/CONTRIBUTING.md +2 -1
- data/docs/aliases.md +79 -0
- data/docs/collection.md +3 -3
- data/docs/config.md +171 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +634 -0
- data/docs/rbs_by_example.md +20 -20
- data/docs/rust.md +96 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +48 -18
- data/docs/type_fingerprint.md +21 -0
- data/docs/wasm_serialization.md +80 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +1441 -671
- data/ext/rbs_extension/ast_translation.h +7 -0
- data/ext/rbs_extension/class_constants.c +18 -2
- data/ext/rbs_extension/class_constants.h +9 -0
- data/ext/rbs_extension/extconf.rb +6 -1
- data/ext/rbs_extension/legacy_location.c +33 -56
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +183 -39
- data/include/rbs/ast.h +597 -297
- data/include/rbs/defines.h +40 -0
- data/include/rbs/lexer.h +31 -11
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +6 -6
- data/include/rbs/serialize.h +39 -0
- data/include/rbs/string.h +0 -2
- data/include/rbs/util/rbs_allocator.h +34 -13
- data/include/rbs/util/rbs_assert.h +12 -1
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs/util/rbs_encoding.h +2 -0
- data/include/rbs/util/rbs_unescape.h +2 -1
- data/include/rbs.h +8 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +27 -31
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +335 -3
- data/lib/rbs/ast/ruby/comment_block.rb +30 -4
- data/lib/rbs/ast/ruby/declarations.rb +209 -4
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
- data/lib/rbs/ast/ruby/helpers/location_helper.rb +1 -1
- data/lib/rbs/ast/ruby/members.rb +571 -22
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +66 -24
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +38 -106
- data/lib/rbs/cli.rb +55 -24
- data/lib/rbs/collection/config/lockfile_generator.rb +28 -3
- data/lib/rbs/collection/sources/git.rb +7 -0
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
- data/lib/rbs/definition_builder/method_builder.rb +32 -6
- data/lib/rbs/definition_builder.rb +147 -25
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment.rb +235 -75
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/errors.rb +27 -18
- data/lib/rbs/inline_parser.rb +377 -15
- data/lib/rbs/location_aux.rb +1 -1
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/namespace.rb +47 -11
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +10 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +120 -44
- data/lib/rbs/rewriter.rb +70 -0
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +25 -3
- data/lib/rbs/type_name.rb +34 -14
- data/lib/rbs/types.rb +88 -78
- data/lib/rbs/unit_test/type_assertions.rb +44 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/wasm/deserializer.rb +213 -0
- data/lib/rbs/wasm/location.rb +61 -0
- data/lib/rbs/wasm/parser.rb +137 -0
- data/lib/rbs/wasm/runtime.rb +217 -0
- data/lib/rbs/wasm/serialization_schema.rb +110 -0
- data/lib/rbs.rb +13 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +24 -6
- data/schema/typeParam.json +17 -1
- data/sig/annotate/rdoc_annotater.rbs +12 -9
- data/sig/ast/ruby/annotations.rbs +364 -4
- data/sig/ast/ruby/comment_block.rbs +8 -0
- data/sig/ast/ruby/declarations.rbs +102 -4
- data/sig/ast/ruby/members.rbs +128 -2
- data/sig/buffer.rbs +19 -1
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/collection/config/lockfile_generator.rbs +2 -0
- data/sig/definition.rbs +6 -1
- data/sig/definition_builder.rbs +2 -0
- data/sig/environment.rbs +70 -12
- data/sig/errors.rbs +13 -14
- data/sig/inline_parser.rbs +41 -2
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -2
- data/sig/method_builder.rbs +3 -1
- data/sig/namespace.rbs +20 -0
- data/sig/parser.rbs +41 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +36 -10
- data/sig/rewriter.rbs +45 -0
- data/sig/source.rbs +3 -3
- data/sig/type_param.rbs +13 -8
- data/sig/typename.rbs +15 -0
- data/sig/types.rbs +6 -7
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +15 -0
- data/sig/wasm/deserializer.rbs +66 -0
- data/sig/wasm/serialization_schema.rbs +13 -0
- data/src/ast.c +443 -162
- data/src/lexer.c +1415 -1313
- data/src/lexer.re +4 -0
- data/src/lexstate.c +63 -37
- data/src/location.c +7 -47
- data/src/parser.c +1032 -521
- data/src/serialize.c +958 -0
- data/src/string.c +0 -48
- data/src/util/rbs_allocator.c +89 -74
- data/src/util/rbs_assert.c +1 -1
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +10 -14
- data/src/util/rbs_encoding.c +4 -8
- data/src/util/rbs_unescape.c +56 -20
- data/stdlib/abbrev/0/array.rbs +1 -1
- data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +7 -4
- data/stdlib/csv/0/csv.rbs +5 -5
- data/stdlib/date/0/date.rbs +92 -79
- data/stdlib/date/0/date_time.rbs +25 -24
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +111 -1
- data/stdlib/erb/0/erb.rbs +748 -347
- data/stdlib/etc/0/etc.rbs +73 -54
- data/stdlib/fileutils/0/fileutils.rbs +179 -160
- data/stdlib/forwardable/0/forwardable.rbs +13 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +223 -142
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +162 -134
- data/stdlib/objspace/0/objspace.rbs +17 -34
- data/stdlib/open-uri/0/open-uri.rbs +48 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +482 -364
- data/stdlib/optparse/0/optparse.rbs +26 -17
- data/stdlib/pathname/0/pathname.rbs +11 -1381
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +65 -12
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -1
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +26 -69
- data/stdlib/ripper/0/ripper.rbs +22 -19
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +3 -3
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/addrinfo.rbs +7 -7
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +23 -10
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +11 -3
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1209 -95
- data/stdlib/strscan/0/string_scanner.rbs +101 -80
- data/stdlib/tempfile/0/tempfile.rbs +25 -21
- data/stdlib/time/0/time.rbs +8 -6
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +4 -1
- data/stdlib/tsort/0/interfaces.rbs +8 -8
- data/stdlib/tsort/0/tsort.rbs +16 -15
- data/stdlib/uri/0/common.rbs +42 -20
- data/stdlib/uri/0/file.rbs +3 -3
- data/stdlib/uri/0/generic.rbs +26 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +12 -12
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +8 -8
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- data/wasm/README.md +59 -0
- data/wasm/rbs_wasm.c +411 -0
- metadata +56 -8
- data/.vscode/extensions.json +0 -5
- data/.vscode/settings.json +0 -19
data/core/kernel.rbs
CHANGED
|
@@ -73,15 +73,18 @@
|
|
|
73
73
|
# ### IO
|
|
74
74
|
#
|
|
75
75
|
# * ::pp: Prints the given objects in pretty form.
|
|
76
|
-
# * #gets: Returns and assigns to
|
|
76
|
+
# * #gets: Returns and assigns to <code>$_</code> the next line from the
|
|
77
|
+
# current input.
|
|
77
78
|
# * #open: Creates an IO object connected to the given stream, file, or
|
|
78
79
|
# subprocess.
|
|
79
80
|
# * #p: Prints the given objects' inspect output to the standard output.
|
|
80
81
|
# * #print: Prints the given objects to standard output without a newline.
|
|
81
82
|
# * #printf: Prints the string resulting from applying the given format string
|
|
82
83
|
# to any additional arguments.
|
|
83
|
-
# * #putc: Equivalent to <
|
|
84
|
-
#
|
|
84
|
+
# * #putc: Equivalent to <code>$stdout.putc(object)</code> for the given
|
|
85
|
+
# object.
|
|
86
|
+
# * #puts: Equivalent to <code>$stdout.puts(*objects)</code> for the given
|
|
87
|
+
# objects.
|
|
85
88
|
# * #readline: Similar to #gets, but raises an exception at the end of file.
|
|
86
89
|
# * #readlines: Returns an array of the remaining lines from the current
|
|
87
90
|
# input.
|
|
@@ -102,7 +105,7 @@
|
|
|
102
105
|
#
|
|
103
106
|
# ### Subprocesses
|
|
104
107
|
#
|
|
105
|
-
# * [
|
|
108
|
+
# * [`command`](rdoc-ref:Kernel#`): Returns the standard output of running
|
|
106
109
|
# `command` in a subshell.
|
|
107
110
|
# * #exec: Replaces current process with a new process.
|
|
108
111
|
# * #fork: Forks the current process into two processes.
|
|
@@ -150,7 +153,7 @@ module Kernel : BasicObject
|
|
|
150
153
|
# - caller(range) -> array or nil
|
|
151
154
|
# -->
|
|
152
155
|
# Returns the current execution stack---an array containing strings in the form
|
|
153
|
-
#
|
|
156
|
+
# <code>file:line</code> or <code>file:line: in `method'</code>.
|
|
154
157
|
#
|
|
155
158
|
# The optional *start* parameter determines the number of initial stack entries
|
|
156
159
|
# to omit from the top of the stack.
|
|
@@ -179,9 +182,9 @@ module Kernel : BasicObject
|
|
|
179
182
|
# c(4) #=> []
|
|
180
183
|
# c(5) #=> nil
|
|
181
184
|
#
|
|
182
|
-
def self?.caller: (
|
|
183
|
-
| (
|
|
184
|
-
| () ->
|
|
185
|
+
def self?.caller: () -> Array[String]
|
|
186
|
+
| (int start, ?int? length) -> Array[String]?
|
|
187
|
+
| (range[int] range) -> Array[String]?
|
|
185
188
|
|
|
186
189
|
# <!--
|
|
187
190
|
# rdoc-file=vm_backtrace.c
|
|
@@ -204,8 +207,9 @@ module Kernel : BasicObject
|
|
|
204
207
|
# Optionally you can pass a range, which will return an array containing the
|
|
205
208
|
# entries within the specified range.
|
|
206
209
|
#
|
|
207
|
-
def self?.caller_locations: (
|
|
208
|
-
| (
|
|
210
|
+
def self?.caller_locations: () -> Array[Thread::Backtrace::Location]
|
|
211
|
+
| (int start, ?int? length) -> Array[Thread::Backtrace::Location]?
|
|
212
|
+
| (range[int] range) -> Array[Thread::Backtrace::Location]?
|
|
209
213
|
|
|
210
214
|
# <!--
|
|
211
215
|
# rdoc-file=vm_eval.c
|
|
@@ -216,10 +220,10 @@ module Kernel : BasicObject
|
|
|
216
220
|
#
|
|
217
221
|
# catch(1) { 123 } # => 123
|
|
218
222
|
#
|
|
219
|
-
# If
|
|
220
|
-
# block whose `tag` has the same `object_id` as *tag2*. When found, the
|
|
221
|
-
# stops executing and returns *val* (or `nil` if no second argument was
|
|
222
|
-
# `throw`).
|
|
223
|
+
# If <code>throw(tag2, val)</code> is called, Ruby searches up its stack for a
|
|
224
|
+
# `catch` block whose `tag` has the same `object_id` as *tag2*. When found, the
|
|
225
|
+
# block stops executing and returns *val* (or `nil` if no second argument was
|
|
226
|
+
# given to `throw`).
|
|
223
227
|
#
|
|
224
228
|
# catch(1) { throw(1, 456) } # => 456
|
|
225
229
|
# catch(1) { throw(1) } # => nil
|
|
@@ -230,8 +234,8 @@ module Kernel : BasicObject
|
|
|
230
234
|
# catch(1) {|x| x + 2 } # => 3
|
|
231
235
|
#
|
|
232
236
|
# When no `tag` is given, `catch` yields a new unique object (as from
|
|
233
|
-
#
|
|
234
|
-
# argument to `throw`, and will match the correct `catch` block.
|
|
237
|
+
# <code>Object.new</code>) as the block parameter. This object can then be used
|
|
238
|
+
# as the argument to `throw`, and will match the correct `catch` block.
|
|
235
239
|
#
|
|
236
240
|
# catch do |obj_A|
|
|
237
241
|
# catch do |obj_B|
|
|
@@ -295,7 +299,7 @@ module Kernel : BasicObject
|
|
|
295
299
|
# - block_given? -> true or false
|
|
296
300
|
# -->
|
|
297
301
|
# Returns `true` if `yield` would execute a block in the current context. The
|
|
298
|
-
#
|
|
302
|
+
# <code>iterator?</code> form is mildly deprecated.
|
|
299
303
|
#
|
|
300
304
|
# def try
|
|
301
305
|
# if block_given?
|
|
@@ -310,6 +314,16 @@ module Kernel : BasicObject
|
|
|
310
314
|
#
|
|
311
315
|
def self?.block_given?: () -> bool
|
|
312
316
|
|
|
317
|
+
alias self.iterator? self.block_given?
|
|
318
|
+
|
|
319
|
+
# <!--
|
|
320
|
+
# rdoc-file=vm_eval.c
|
|
321
|
+
# - iterator? -> true or false
|
|
322
|
+
# -->
|
|
323
|
+
# Deprecated. Use block_given? instead.
|
|
324
|
+
#
|
|
325
|
+
alias iterator? block_given?
|
|
326
|
+
|
|
313
327
|
# <!--
|
|
314
328
|
# rdoc-file=vm_eval.c
|
|
315
329
|
# - local_variables -> array
|
|
@@ -322,7 +336,7 @@ module Kernel : BasicObject
|
|
|
322
336
|
# end
|
|
323
337
|
# local_variables #=> [:fred, :i]
|
|
324
338
|
#
|
|
325
|
-
def self?.local_variables: () ->
|
|
339
|
+
def self?.local_variables: () -> Array[Symbol]
|
|
326
340
|
|
|
327
341
|
# <!--
|
|
328
342
|
# rdoc-file=random.c
|
|
@@ -421,7 +435,8 @@ module Kernel : BasicObject
|
|
|
421
435
|
# Array({foo: 0, bar: 1}) # => [[:foo, 0], [:bar, 1]]
|
|
422
436
|
# Array(0..4) # => [0, 1, 2, 3, 4]
|
|
423
437
|
#
|
|
424
|
-
# Returns `object` in an array,
|
|
438
|
+
# Returns `object` in an array, <code>[object]</code>, if `object` cannot be
|
|
439
|
+
# converted:
|
|
425
440
|
#
|
|
426
441
|
# Array(:foo) # => [:foo]
|
|
427
442
|
#
|
|
@@ -437,8 +452,8 @@ module Kernel : BasicObject
|
|
|
437
452
|
# Returns a new Complex object if the arguments are valid; otherwise raises an
|
|
438
453
|
# exception if `exception` is `true`; otherwise returns `nil`.
|
|
439
454
|
#
|
|
440
|
-
# With Numeric arguments `real` and `imag`, returns
|
|
441
|
-
# if the arguments are valid.
|
|
455
|
+
# With Numeric arguments `real` and `imag`, returns <code>Complex.rect(real,
|
|
456
|
+
# imag)</code> if the arguments are valid.
|
|
442
457
|
#
|
|
443
458
|
# With string argument `s`, returns a new Complex object if the argument is
|
|
444
459
|
# valid; the string may have:
|
|
@@ -448,7 +463,7 @@ module Kernel : BasicObject
|
|
|
448
463
|
# coordinates](rdoc-ref:Complex@Rectangular+Coordinates):
|
|
449
464
|
#
|
|
450
465
|
# * Sign-separated real and imaginary numeric substrings (with trailing
|
|
451
|
-
# character
|
|
466
|
+
# character <code>'i'</code>):
|
|
452
467
|
#
|
|
453
468
|
# Complex('1+2i') # => (1+2i)
|
|
454
469
|
# Complex('+1+2i') # => (1+2i)
|
|
@@ -456,13 +471,15 @@ module Kernel : BasicObject
|
|
|
456
471
|
# Complex('-1+2i') # => (-1+2i)
|
|
457
472
|
# Complex('-1-2i') # => (-1-2i)
|
|
458
473
|
#
|
|
459
|
-
# * Real-only numeric string (without trailing character
|
|
474
|
+
# * Real-only numeric string (without trailing character
|
|
475
|
+
# <code>'i'</code>):
|
|
460
476
|
#
|
|
461
477
|
# Complex('1') # => (1+0i)
|
|
462
478
|
# Complex('+1') # => (1+0i)
|
|
463
479
|
# Complex('-1') # => (-1+0i)
|
|
464
480
|
#
|
|
465
|
-
# * Imaginary-only numeric string (with trailing character
|
|
481
|
+
# * Imaginary-only numeric string (with trailing character
|
|
482
|
+
# <code>'i'</code>):
|
|
466
483
|
#
|
|
467
484
|
# Complex('1i') # => (0+1i)
|
|
468
485
|
# Complex('+1i') # => (0+1i)
|
|
@@ -489,10 +506,10 @@ module Kernel : BasicObject
|
|
|
489
506
|
# - Float(arg, exception: true) -> float or nil
|
|
490
507
|
# -->
|
|
491
508
|
# Returns *arg* converted to a float. Numeric types are converted directly, and
|
|
492
|
-
# with exception to String and `nil`, the rest are converted using
|
|
493
|
-
# Converting a String with invalid characters will
|
|
494
|
-
# Converting `nil` generates a TypeError. Exceptions
|
|
495
|
-
# passing
|
|
509
|
+
# with exception to String and `nil`, the rest are converted using
|
|
510
|
+
# *arg*<code>.to_f</code>. Converting a String with invalid characters will
|
|
511
|
+
# result in an ArgumentError. Converting `nil` generates a TypeError. Exceptions
|
|
512
|
+
# can be suppressed by passing <code>exception: false</code>.
|
|
496
513
|
#
|
|
497
514
|
# Float(1) #=> 1.0
|
|
498
515
|
# Float("123.456") #=> 123.456
|
|
@@ -515,7 +532,8 @@ module Kernel : BasicObject
|
|
|
515
532
|
# * A hash, returns `object`.
|
|
516
533
|
# * An empty array or `nil`, returns an empty hash.
|
|
517
534
|
#
|
|
518
|
-
# * Otherwise, if
|
|
535
|
+
# * Otherwise, if <code>object.to_hash</code> returns a hash, returns that
|
|
536
|
+
# hash.
|
|
519
537
|
# * Otherwise, returns TypeError.
|
|
520
538
|
#
|
|
521
539
|
# Examples:
|
|
@@ -621,7 +639,7 @@ module Kernel : BasicObject
|
|
|
621
639
|
# - Rational(x, y, exception: true) -> rational or nil
|
|
622
640
|
# - Rational(arg, exception: true) -> rational or nil
|
|
623
641
|
# -->
|
|
624
|
-
# Returns
|
|
642
|
+
# Returns <code>x/y</code> or `arg` as a Rational.
|
|
625
643
|
#
|
|
626
644
|
# Rational(2, 3) #=> (2/3)
|
|
627
645
|
# Rational(5) #=> (5/1)
|
|
@@ -697,7 +715,7 @@ module Kernel : BasicObject
|
|
|
697
715
|
# Returns the canonicalized absolute path of the directory of the file from
|
|
698
716
|
# which this method is called. It means symlinks in the path is resolved. If
|
|
699
717
|
# `__FILE__` is `nil`, it returns `nil`. The return value equals to
|
|
700
|
-
#
|
|
718
|
+
# <code>File.dirname(File.realpath(__FILE__))</code>.
|
|
701
719
|
#
|
|
702
720
|
def self?.__dir__: () -> String?
|
|
703
721
|
|
|
@@ -714,20 +732,20 @@ module Kernel : BasicObject
|
|
|
714
732
|
# rdoc-file=io.c
|
|
715
733
|
# - `command` -> string
|
|
716
734
|
# -->
|
|
717
|
-
# Returns the
|
|
718
|
-
# variable
|
|
735
|
+
# Returns the <code>$stdout</code> output from running `command` in a subshell;
|
|
736
|
+
# sets global variable <code>$?</code> to the process status.
|
|
719
737
|
#
|
|
720
738
|
# This method has potential security vulnerabilities if called with untrusted
|
|
721
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
739
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
722
740
|
#
|
|
723
741
|
# Examples:
|
|
724
742
|
#
|
|
725
743
|
# $ `date` # => "Wed Apr 9 08:56:30 CDT 2003\n"
|
|
726
744
|
# $ `echo oops && exit 99` # => "oops\n"
|
|
727
745
|
# $ $? # => #<Process::Status: pid 17088 exit 99>
|
|
728
|
-
# $ $?.
|
|
746
|
+
# $ $?.exitstatus # => 99
|
|
729
747
|
#
|
|
730
|
-
# The built-in syntax
|
|
748
|
+
# The built-in syntax <code>%x{...}</code> uses this method.
|
|
731
749
|
#
|
|
732
750
|
def self?.`: (String arg0) -> String
|
|
733
751
|
|
|
@@ -736,7 +754,8 @@ module Kernel : BasicObject
|
|
|
736
754
|
# - abort
|
|
737
755
|
# - Process.abort(msg = nil)
|
|
738
756
|
# -->
|
|
739
|
-
# Terminates execution immediately, effectively by calling
|
|
757
|
+
# Terminates execution immediately, effectively by calling
|
|
758
|
+
# <code>Kernel.exit(false)</code>.
|
|
740
759
|
#
|
|
741
760
|
# If string argument `msg` is given, it is written to STDERR prior to
|
|
742
761
|
# termination; otherwise, if an exception was raised, prints its message and
|
|
@@ -759,7 +778,7 @@ module Kernel : BasicObject
|
|
|
759
778
|
# do_at_exit("goodbye ")
|
|
760
779
|
# exit
|
|
761
780
|
#
|
|
762
|
-
#
|
|
781
|
+
# <em>produces:</em>
|
|
763
782
|
#
|
|
764
783
|
# goodbye cruel world
|
|
765
784
|
#
|
|
@@ -777,7 +796,9 @@ module Kernel : BasicObject
|
|
|
777
796
|
# If *const* is defined as autoload, the file name to be loaded is replaced with
|
|
778
797
|
# *filename*. If *const* is defined but not as autoload, does nothing.
|
|
779
798
|
#
|
|
780
|
-
|
|
799
|
+
# Files that are currently being loaded must not be registered for autoload.
|
|
800
|
+
#
|
|
801
|
+
def self?.autoload: (interned const, path filename) -> nil
|
|
781
802
|
|
|
782
803
|
# <!--
|
|
783
804
|
# rdoc-file=load.c
|
|
@@ -801,7 +822,7 @@ module Kernel : BasicObject
|
|
|
801
822
|
# autoload?(:B) #=> "b"
|
|
802
823
|
# end
|
|
803
824
|
#
|
|
804
|
-
def self?.autoload?: (interned name) -> String?
|
|
825
|
+
def self?.autoload?: (interned name, ?boolish inherit) -> String?
|
|
805
826
|
|
|
806
827
|
# <!--
|
|
807
828
|
# rdoc-file=proc.c
|
|
@@ -984,13 +1005,14 @@ module Kernel : BasicObject
|
|
|
984
1005
|
# end
|
|
985
1006
|
# # => #<RuntimeError: RuntimeError>
|
|
986
1007
|
#
|
|
987
|
-
# If keyword argument `cause` is not given, the cause is the value of
|
|
1008
|
+
# If keyword argument `cause` is not given, the cause is the value of
|
|
1009
|
+
# <code>$!</code>.
|
|
988
1010
|
#
|
|
989
1011
|
# See [Cause](rdoc-ref:exceptions.md@Cause).
|
|
990
1012
|
#
|
|
991
1013
|
# In the alternate calling sequence, where argument `exception` *not* given,
|
|
992
|
-
# raises a new exception of the class given by
|
|
993
|
-
#
|
|
1014
|
+
# raises a new exception of the class given by <code>$!</code>, or of class
|
|
1015
|
+
# RuntimeError if <code>$!</code> is `nil`:
|
|
994
1016
|
#
|
|
995
1017
|
# begin
|
|
996
1018
|
# raise
|
|
@@ -1002,9 +1024,11 @@ module Kernel : BasicObject
|
|
|
1002
1024
|
# With argument `exception` not given, argument `message` and keyword argument
|
|
1003
1025
|
# `cause` may be given, but argument `backtrace` may not be given.
|
|
1004
1026
|
#
|
|
1027
|
+
# `cause` can not be given as an only argument.
|
|
1028
|
+
#
|
|
1005
1029
|
def self?.fail: () -> bot
|
|
1006
1030
|
| (string message, ?cause: Exception?) -> bot
|
|
1007
|
-
| (_Exception exception, ?_ToS
|
|
1031
|
+
| (_Exception exception, ?string | _ToS message, ?String | Array[String] | Array[Thread::Backtrace::Location] | nil backtrace, ?cause: Exception?) -> bot
|
|
1008
1032
|
| (_Exception exception, ?cause: Exception?, **untyped) -> bot
|
|
1009
1033
|
|
|
1010
1034
|
# <!--
|
|
@@ -1090,13 +1114,14 @@ module Kernel : BasicObject
|
|
|
1090
1114
|
# end
|
|
1091
1115
|
# # => #<RuntimeError: RuntimeError>
|
|
1092
1116
|
#
|
|
1093
|
-
# If keyword argument `cause` is not given, the cause is the value of
|
|
1117
|
+
# If keyword argument `cause` is not given, the cause is the value of
|
|
1118
|
+
# <code>$!</code>.
|
|
1094
1119
|
#
|
|
1095
1120
|
# See [Cause](rdoc-ref:exceptions.md@Cause).
|
|
1096
1121
|
#
|
|
1097
1122
|
# In the alternate calling sequence, where argument `exception` *not* given,
|
|
1098
|
-
# raises a new exception of the class given by
|
|
1099
|
-
#
|
|
1123
|
+
# raises a new exception of the class given by <code>$!</code>, or of class
|
|
1124
|
+
# RuntimeError if <code>$!</code> is `nil`:
|
|
1100
1125
|
#
|
|
1101
1126
|
# begin
|
|
1102
1127
|
# raise
|
|
@@ -1108,6 +1133,8 @@ module Kernel : BasicObject
|
|
|
1108
1133
|
# With argument `exception` not given, argument `message` and keyword argument
|
|
1109
1134
|
# `cause` may be given, but argument `backtrace` may not be given.
|
|
1110
1135
|
#
|
|
1136
|
+
# `cause` can not be given as an only argument.
|
|
1137
|
+
#
|
|
1111
1138
|
alias raise fail
|
|
1112
1139
|
|
|
1113
1140
|
alias self.raise self.fail
|
|
@@ -1116,7 +1143,7 @@ module Kernel : BasicObject
|
|
|
1116
1143
|
# Returns the string resulting from formatting `objects` into `format_string`.
|
|
1117
1144
|
#
|
|
1118
1145
|
# For details on `format_string`, see [Format
|
|
1119
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1146
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1120
1147
|
#
|
|
1121
1148
|
def self?.format: (String format, *untyped args) -> String
|
|
1122
1149
|
|
|
@@ -1127,7 +1154,7 @@ module Kernel : BasicObject
|
|
|
1127
1154
|
# Returns the string resulting from formatting `objects` into `format_string`.
|
|
1128
1155
|
#
|
|
1129
1156
|
# For details on `format_string`, see [Format
|
|
1130
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1157
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1131
1158
|
#
|
|
1132
1159
|
alias sprintf format
|
|
1133
1160
|
|
|
@@ -1139,29 +1166,29 @@ module Kernel : BasicObject
|
|
|
1139
1166
|
# - gets(limit [, getline_args]) -> string or nil
|
|
1140
1167
|
# - gets(sep, limit [, getline_args]) -> string or nil
|
|
1141
1168
|
# -->
|
|
1142
|
-
# Returns (and assigns to
|
|
1143
|
-
# (or
|
|
1144
|
-
# Returns `nil` at end of file. The optional argument
|
|
1145
|
-
# separator. The separator is included with the contents of
|
|
1146
|
-
# separator of `nil` reads the entire contents, and a zero-length
|
|
1147
|
-
# reads the input one paragraph at a time, where paragraphs are
|
|
1148
|
-
# consecutive newlines. If the first argument is an integer, or
|
|
1149
|
-
# argument is given, the returning string would not be longer
|
|
1150
|
-
# value in bytes. If multiple filenames are present in `ARGV`,
|
|
1151
|
-
# read the contents one file at a time.
|
|
1169
|
+
# Returns (and assigns to <code>$_</code>) the next line from the list of files
|
|
1170
|
+
# in `ARGV` (or <code>$*</code>), or from standard input if no files are present
|
|
1171
|
+
# on the command line. Returns `nil` at end of file. The optional argument
|
|
1172
|
+
# specifies the record separator. The separator is included with the contents of
|
|
1173
|
+
# each record. A separator of `nil` reads the entire contents, and a zero-length
|
|
1174
|
+
# separator reads the input one paragraph at a time, where paragraphs are
|
|
1175
|
+
# divided by two consecutive newlines. If the first argument is an integer, or
|
|
1176
|
+
# optional second argument is given, the returning string would not be longer
|
|
1177
|
+
# than the given value in bytes. If multiple filenames are present in `ARGV`,
|
|
1178
|
+
# <code>gets(nil)</code> will read the contents one file at a time.
|
|
1152
1179
|
#
|
|
1153
1180
|
# ARGV << "testfile"
|
|
1154
1181
|
# print while gets
|
|
1155
1182
|
#
|
|
1156
|
-
#
|
|
1183
|
+
# <em>produces:</em>
|
|
1157
1184
|
#
|
|
1158
1185
|
# This is line one
|
|
1159
1186
|
# This is line two
|
|
1160
1187
|
# This is line three
|
|
1161
1188
|
# And so on...
|
|
1162
1189
|
#
|
|
1163
|
-
# The style of programming using
|
|
1164
|
-
# losing favor in the Ruby community.
|
|
1190
|
+
# The style of programming using <code>$_</code> as an implicit parameter is
|
|
1191
|
+
# gradually losing favor in the Ruby community.
|
|
1165
1192
|
#
|
|
1166
1193
|
def self?.gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String?
|
|
1167
1194
|
|
|
@@ -1170,12 +1197,13 @@ module Kernel : BasicObject
|
|
|
1170
1197
|
# - global_variables -> array
|
|
1171
1198
|
# -->
|
|
1172
1199
|
# Returns an array of the names of global variables. This includes special
|
|
1173
|
-
# regexp global variables such as
|
|
1174
|
-
# numbered regexp global variables (
|
|
1200
|
+
# regexp global variables such as <code>$~</code> and <code>$+</code>, but does
|
|
1201
|
+
# not include the numbered regexp global variables (<code>$1</code>,
|
|
1202
|
+
# <code>$2</code>, etc.).
|
|
1175
1203
|
#
|
|
1176
1204
|
# global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
|
|
1177
1205
|
#
|
|
1178
|
-
def self?.global_variables: () ->
|
|
1206
|
+
def self?.global_variables: () -> Array[Symbol]
|
|
1179
1207
|
|
|
1180
1208
|
# <!--
|
|
1181
1209
|
# rdoc-file=load.c
|
|
@@ -1190,10 +1218,10 @@ module Kernel : BasicObject
|
|
|
1190
1218
|
# the file will be loaded using the relative path from the current directory.
|
|
1191
1219
|
#
|
|
1192
1220
|
# Otherwise, the file will be searched for in the library directories listed in
|
|
1193
|
-
#
|
|
1194
|
-
# load the file relative to that directory. If
|
|
1195
|
-
# the
|
|
1196
|
-
# path from the current directory.
|
|
1221
|
+
# <code>$LOAD_PATH</code> (<code>$:</code>). If the file is found in a
|
|
1222
|
+
# directory, it will attempt to load the file relative to that directory. If
|
|
1223
|
+
# the file is not found in any of the directories in <code>$LOAD_PATH</code>,
|
|
1224
|
+
# the file will be loaded using the relative path from the current directory.
|
|
1197
1225
|
#
|
|
1198
1226
|
# If the file doesn't exist when there is an attempt to load it, a LoadError
|
|
1199
1227
|
# will be raised.
|
|
@@ -1218,6 +1246,7 @@ module Kernel : BasicObject
|
|
|
1218
1246
|
# loop do
|
|
1219
1247
|
# print "Input: "
|
|
1220
1248
|
# line = gets
|
|
1249
|
+
# # break if q, Q is entered or EOF signal (Ctrl-D on Unix, Ctrl-Z on windows) is sent
|
|
1221
1250
|
# break if !line or line =~ /^q/i
|
|
1222
1251
|
# # ...
|
|
1223
1252
|
# end
|
|
@@ -1245,9 +1274,6 @@ module Kernel : BasicObject
|
|
|
1245
1274
|
# -->
|
|
1246
1275
|
# Creates an IO object connected to the given file.
|
|
1247
1276
|
#
|
|
1248
|
-
# This method has potential security vulnerabilities if called with untrusted
|
|
1249
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
1250
|
-
#
|
|
1251
1277
|
# With no block given, file stream is returned:
|
|
1252
1278
|
#
|
|
1253
1279
|
# open('t.txt') # => #<File:t.txt>
|
|
@@ -1270,18 +1296,19 @@ module Kernel : BasicObject
|
|
|
1270
1296
|
# rdoc-file=io.c
|
|
1271
1297
|
# - print(*objects) -> nil
|
|
1272
1298
|
# -->
|
|
1273
|
-
# Equivalent to
|
|
1274
|
-
# way to write to
|
|
1299
|
+
# Equivalent to <code>$stdout.print(*objects)</code>, this method is the
|
|
1300
|
+
# straightforward way to write to <code>$stdout</code>.
|
|
1275
1301
|
#
|
|
1276
|
-
# Writes the given objects to
|
|
1277
|
-
# record separator
|
|
1302
|
+
# Writes the given objects to <code>$stdout</code>; returns `nil`. Appends the
|
|
1303
|
+
# output record separator <code>$OUTPUT_RECORD_SEPARATOR</code>
|
|
1304
|
+
# <code>$\</code>), if it is not `nil`.
|
|
1278
1305
|
#
|
|
1279
1306
|
# With argument `objects` given, for each object:
|
|
1280
1307
|
#
|
|
1281
1308
|
# * Converts via its method `to_s` if not a string.
|
|
1282
1309
|
# * Writes to `stdout`.
|
|
1283
1310
|
# * If not the last object, writes the output field separator
|
|
1284
|
-
#
|
|
1311
|
+
# <code>$OUTPUT_FIELD_SEPARATOR</code> (<code>$,</code> if it is not `nil`.
|
|
1285
1312
|
#
|
|
1286
1313
|
# With default separators:
|
|
1287
1314
|
#
|
|
@@ -1306,8 +1333,8 @@ module Kernel : BasicObject
|
|
|
1306
1333
|
#
|
|
1307
1334
|
# 0,0.0,0/1,0+0i,zero,zero
|
|
1308
1335
|
#
|
|
1309
|
-
# With no argument given, writes the content of
|
|
1310
|
-
# recent user input):
|
|
1336
|
+
# With no argument given, writes the content of <code>$_</code> (which is
|
|
1337
|
+
# usually the most recent user input):
|
|
1311
1338
|
#
|
|
1312
1339
|
# gets # Sets $_ to the most recent user input.
|
|
1313
1340
|
# print # Prints $_.
|
|
@@ -1324,7 +1351,7 @@ module Kernel : BasicObject
|
|
|
1324
1351
|
# io.write(sprintf(format_string, *objects))
|
|
1325
1352
|
#
|
|
1326
1353
|
# For details on `format_string`, see [Format
|
|
1327
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1354
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1328
1355
|
#
|
|
1329
1356
|
# With the single argument `format_string`, formats `objects` into the string,
|
|
1330
1357
|
# then writes the formatted string to $stdout:
|
|
@@ -1429,7 +1456,7 @@ module Kernel : BasicObject
|
|
|
1429
1456
|
# -->
|
|
1430
1457
|
# prints arguments in pretty form.
|
|
1431
1458
|
#
|
|
1432
|
-
#
|
|
1459
|
+
# <code>#pp</code> returns argument(s).
|
|
1433
1460
|
#
|
|
1434
1461
|
def self?.pp: [T] (T arg0) -> T
|
|
1435
1462
|
| (untyped, untyped, *untyped) -> Array[untyped]
|
|
@@ -1439,19 +1466,20 @@ module Kernel : BasicObject
|
|
|
1439
1466
|
# rdoc-file=random.c
|
|
1440
1467
|
# - rand(max=0) -> number
|
|
1441
1468
|
# -->
|
|
1442
|
-
# If called without an argument, or if
|
|
1443
|
-
# pseudo-random floating point number between 0.0 and 1.0, including
|
|
1444
|
-
# excluding 1.0.
|
|
1469
|
+
# If called without an argument, or if <code>max.to_i.abs == 0</code>, rand
|
|
1470
|
+
# returns a pseudo-random floating point number between 0.0 and 1.0, including
|
|
1471
|
+
# 0.0 and excluding 1.0.
|
|
1445
1472
|
#
|
|
1446
1473
|
# rand #=> 0.2725926052826416
|
|
1447
1474
|
#
|
|
1448
|
-
# When
|
|
1449
|
-
# integer greater than or equal to 0 and less than
|
|
1475
|
+
# When <code>max.abs</code> is greater than or equal to 1, `rand` returns a
|
|
1476
|
+
# pseudo-random integer greater than or equal to 0 and less than
|
|
1477
|
+
# <code>max.to_i.abs</code>.
|
|
1450
1478
|
#
|
|
1451
1479
|
# rand(100) #=> 12
|
|
1452
1480
|
#
|
|
1453
1481
|
# When `max` is a Range, `rand` returns a random number where
|
|
1454
|
-
#
|
|
1482
|
+
# <code>range.member?(number) == true</code>.
|
|
1455
1483
|
#
|
|
1456
1484
|
# Negative or floating point values for `max` are allowed, but may give
|
|
1457
1485
|
# surprising results.
|
|
@@ -1463,7 +1491,9 @@ module Kernel : BasicObject
|
|
|
1463
1491
|
# Kernel.srand may be used to ensure that sequences of random numbers are
|
|
1464
1492
|
# reproducible between different runs of a program.
|
|
1465
1493
|
#
|
|
1466
|
-
#
|
|
1494
|
+
# Related: Random.rand.
|
|
1495
|
+
# rand(100.0) # => 64 (Integer because max.to_i is 100)
|
|
1496
|
+
# Random.rand(100.0) # => 30.315320967824523
|
|
1467
1497
|
#
|
|
1468
1498
|
def self?.rand: (?0) -> Float
|
|
1469
1499
|
| (int arg0) -> Integer
|
|
@@ -1550,7 +1580,7 @@ module Kernel : BasicObject
|
|
|
1550
1580
|
# When RubyGems is required, Kernel#require is replaced with our own which is
|
|
1551
1581
|
# capable of loading gems on demand.
|
|
1552
1582
|
#
|
|
1553
|
-
# When you call
|
|
1583
|
+
# When you call <code>require 'x'</code>, this is what happens:
|
|
1554
1584
|
# * If the file can be loaded from the existing Ruby loadpath, it is.
|
|
1555
1585
|
# * Otherwise, installed gems are searched for a file that matches. If it's
|
|
1556
1586
|
# found in gem 'y', that gem is activated (added to the loadpath).
|
|
@@ -1585,7 +1615,9 @@ module Kernel : BasicObject
|
|
|
1585
1615
|
# IO objects.
|
|
1586
1616
|
#
|
|
1587
1617
|
# Argument `timeout` is a numeric value (such as integer or float) timeout
|
|
1588
|
-
# interval in seconds.
|
|
1618
|
+
# interval in seconds. `timeout` can also be `nil` or
|
|
1619
|
+
# <code>Float::INFINITY</code>. `nil` and <code>Float::INFINITY</code> means no
|
|
1620
|
+
# timeout.
|
|
1589
1621
|
#
|
|
1590
1622
|
# The method monitors the IO objects given in all three arrays, waiting for some
|
|
1591
1623
|
# to be ready; returns a 3-element array whose elements are:
|
|
@@ -1660,8 +1692,8 @@ module Kernel : BasicObject
|
|
|
1660
1692
|
#
|
|
1661
1693
|
# The writability notified by select(2) doesn't show how many bytes are
|
|
1662
1694
|
# writable. IO#write method blocks until given whole string is written. So,
|
|
1663
|
-
#
|
|
1664
|
-
# IO.select. IO#write_nonblock is required to avoid the blocking.
|
|
1695
|
+
# <code>IO#write(two or more bytes)</code> can block after writability is
|
|
1696
|
+
# notified by IO.select. IO#write_nonblock is required to avoid the blocking.
|
|
1665
1697
|
#
|
|
1666
1698
|
# Blocking write (#write) can be emulated using #write_nonblock and IO.select as
|
|
1667
1699
|
# follows: IO::WaitReadable should also be rescued for SSL renegotiation in
|
|
@@ -1729,11 +1761,6 @@ module Kernel : BasicObject
|
|
|
1729
1761
|
def self?.sleep: (?nil) -> bot
|
|
1730
1762
|
| (Time::_Timeout duration) -> Integer
|
|
1731
1763
|
|
|
1732
|
-
%a{deprecated}
|
|
1733
|
-
interface _Divmod
|
|
1734
|
-
def divmod: (Numeric) -> [ Numeric, Numeric ]
|
|
1735
|
-
end
|
|
1736
|
-
|
|
1737
1764
|
# <!--
|
|
1738
1765
|
# rdoc-file=io.c
|
|
1739
1766
|
# - syscall(integer_callno, *arguments) -> integer
|
|
@@ -1773,60 +1800,65 @@ module Kernel : BasicObject
|
|
|
1773
1800
|
# * Each of these tests operates only on the entity at `path0`,
|
|
1774
1801
|
# and returns `true` or `false`;
|
|
1775
1802
|
# for a non-existent entity, returns `false` (does not raise exception):
|
|
1776
|
-
#
|
|
1777
|
-
#
|
|
1778
|
-
# <
|
|
1779
|
-
# <
|
|
1780
|
-
# <
|
|
1781
|
-
# <
|
|
1782
|
-
# <
|
|
1783
|
-
# <
|
|
1784
|
-
# <
|
|
1785
|
-
# <
|
|
1786
|
-
# <
|
|
1787
|
-
# <
|
|
1788
|
-
# <
|
|
1789
|
-
# <
|
|
1790
|
-
# <
|
|
1791
|
-
# <
|
|
1792
|
-
# <
|
|
1793
|
-
# <
|
|
1794
|
-
# <
|
|
1795
|
-
# <
|
|
1796
|
-
# <
|
|
1797
|
-
# <
|
|
1798
|
-
# <
|
|
1803
|
+
# Character |Test
|
|
1804
|
+
# ----------------|-----------------------------------------------------------------------------
|
|
1805
|
+
# <code>'b'</code>|Whether the entity is a block device.
|
|
1806
|
+
# <code>'c'</code>|Whether the entity is a character device.
|
|
1807
|
+
# <code>'d'</code>|Whether the entity is a directory.
|
|
1808
|
+
# <code>'e'</code>|Whether the entity is an existing entity.
|
|
1809
|
+
# <code>'f'</code>|Whether the entity is an existing regular file.
|
|
1810
|
+
# <code>'g'</code>|Whether the entity's setgid bit is set.
|
|
1811
|
+
# <code>'G'</code>|Whether the entity's group ownership is equal to the caller's.
|
|
1812
|
+
# <code>'k'</code>|Whether the entity's sticky bit is set.
|
|
1813
|
+
# <code>'l'</code>|Whether the entity is a symbolic link.
|
|
1814
|
+
# <code>'o'</code>|Whether the entity is owned by the caller's effective uid.
|
|
1815
|
+
# <code>'O'</code>|Like <code>'o'</code>, but uses the real uid (not the effective uid).
|
|
1816
|
+
# <code>'p'</code>|Whether the entity is a FIFO device (named pipe).
|
|
1817
|
+
# <code>'r'</code>|Whether the entity is readable by the caller's effective uid/gid.
|
|
1818
|
+
# <code>'R'</code>|Like <code>'r'</code>, but uses the real uid/gid (not the effective uid/gid).
|
|
1819
|
+
# <code>'S'</code>|Whether the entity is a socket.
|
|
1820
|
+
# <code>'u'</code>|Whether the entity's setuid bit is set.
|
|
1821
|
+
# <code>'w'</code>|Whether the entity is writable by the caller's effective uid/gid.
|
|
1822
|
+
# <code>'W'</code>|Like <code>'w'</code>, but uses the real uid/gid (not the effective uid/gid).
|
|
1823
|
+
# <code>'x'</code>|Whether the entity is executable by the caller's effective uid/gid.
|
|
1824
|
+
# <code>'X'</code>|Like <code>'x'</code>, but uses the real uid/gid (not the effective uid/git).
|
|
1825
|
+
# <code>'z'</code>|Whether the entity exists and is of length zero.
|
|
1799
1826
|
# * This test operates only on the entity at `path0`,
|
|
1800
|
-
# and returns an integer size or
|
|
1801
|
-
#
|
|
1802
|
-
#
|
|
1803
|
-
# <
|
|
1827
|
+
# and returns an integer size or +nil+:
|
|
1828
|
+
# Character |Test
|
|
1829
|
+
# ----------------|--------------------------------------------------------------------------------------------
|
|
1830
|
+
# <code>'s'</code>|Returns positive integer size if the entity exists and has non-zero length, +nil+ otherwise.
|
|
1804
1831
|
# * Each of these tests operates only on the entity at `path0`,
|
|
1805
1832
|
# and returns a Time object;
|
|
1806
1833
|
# raises an exception if the entity does not exist:
|
|
1807
|
-
#
|
|
1808
|
-
#
|
|
1809
|
-
# <
|
|
1810
|
-
# <
|
|
1811
|
-
# <
|
|
1834
|
+
# Character |Test
|
|
1835
|
+
# ----------------|--------------------------------------
|
|
1836
|
+
# <code>'A'</code>|Last access time for the entity.
|
|
1837
|
+
# <code>'C'</code>|Last change time for the entity.
|
|
1838
|
+
# <code>'M'</code>|Last modification time for the entity.
|
|
1812
1839
|
# * Each of these tests operates on the modification time (`mtime`)
|
|
1813
1840
|
# of each of the entities at `path0` and `path1`,
|
|
1814
1841
|
# and returns a `true` or `false`;
|
|
1815
1842
|
# returns `false` if either entity does not exist:
|
|
1816
|
-
#
|
|
1817
|
-
#
|
|
1818
|
-
# <
|
|
1819
|
-
# <
|
|
1820
|
-
# <
|
|
1843
|
+
# Character |Test
|
|
1844
|
+
# ----------------|---------------------------------------------------------------
|
|
1845
|
+
# <code>'<'</code>|Whether the `mtime` at `path0` is less than that at `path1`.
|
|
1846
|
+
# <code>'='</code>|Whether the `mtime` at `path0` is equal to that at `path1`.
|
|
1847
|
+
# <code>'>'</code>|Whether the `mtime` at `path0` is greater than that at `path1`.
|
|
1821
1848
|
# * This test operates on the content of each of the entities at `path0` and
|
|
1822
1849
|
# `path1`,
|
|
1823
1850
|
# and returns a `true` or `false`;
|
|
1824
1851
|
# returns `false` if either entity does not exist:
|
|
1825
|
-
#
|
|
1826
|
-
#
|
|
1827
|
-
# <
|
|
1852
|
+
# Character |Test
|
|
1853
|
+
# ----------------|---------------------------------------------
|
|
1854
|
+
# <code>'-'</code>|Whether the entities exist and are identical.
|
|
1828
1855
|
#
|
|
1829
|
-
def self?.test: (
|
|
1856
|
+
def self?.test: ('b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'G' | 'k' | 'l' | 'o' | 'O' | 'p' | 'r' | 'R' | 'S' | 'u' | 'w' | 'W' | 'x' | 'X' | 'z' |
|
|
1857
|
+
98 | 99 | 100 | 101 | 102 | 103 | 71 | 107 | 108 | 111 | 79 | 112 | 114 | 82 | 83 | 117 | 119 | 87 | 120 | 88 | 122, path filepath) -> bool
|
|
1858
|
+
| ('s' | 115, path filepath) -> Integer?
|
|
1859
|
+
| ('A' | 'M' | 'C' | 65 | 77 | 67, path filepath) -> Time
|
|
1860
|
+
| ('<' | '=' | '>' | '-' | 60 | 61 | 62 | 45, path filepath1, path filepath2) -> bool
|
|
1861
|
+
| (String | int cmd, path filepath1, ?path filepath2) -> (bool | Time | Integer | nil)
|
|
1830
1862
|
|
|
1831
1863
|
# <!--
|
|
1832
1864
|
# rdoc-file=vm_eval.c
|
|
@@ -1843,14 +1875,14 @@ module Kernel : BasicObject
|
|
|
1843
1875
|
# rdoc-file=warning.rb
|
|
1844
1876
|
# - warn(*msgs, uplevel: nil, category: nil) -> nil
|
|
1845
1877
|
# -->
|
|
1846
|
-
# If warnings have been disabled (for example with the
|
|
1847
|
-
# nothing. Otherwise, converts each of the messages to strings, appends a
|
|
1878
|
+
# If warnings have been disabled (for example with the <code>-W0</code> flag),
|
|
1879
|
+
# does nothing. Otherwise, converts each of the messages to strings, appends a
|
|
1848
1880
|
# newline character to the string if the string does not end in a newline, and
|
|
1849
1881
|
# calls Warning.warn with the string.
|
|
1850
1882
|
#
|
|
1851
1883
|
# warn("warning 1", "warning 2")
|
|
1852
1884
|
#
|
|
1853
|
-
#
|
|
1885
|
+
# <em>produces:</em>
|
|
1854
1886
|
#
|
|
1855
1887
|
# warning 1
|
|
1856
1888
|
# warning 2
|
|
@@ -1870,12 +1902,13 @@ module Kernel : BasicObject
|
|
|
1870
1902
|
#
|
|
1871
1903
|
# bar
|
|
1872
1904
|
#
|
|
1873
|
-
#
|
|
1905
|
+
# <em>produces:</em>
|
|
1874
1906
|
#
|
|
1875
1907
|
# baz.rb:6: warning: invalid call to foo
|
|
1876
1908
|
#
|
|
1877
1909
|
# If `category` keyword argument is given, passes the category to
|
|
1878
|
-
#
|
|
1910
|
+
# <code>Warning.warn</code>. The category given must be one of the following
|
|
1911
|
+
# categories:
|
|
1879
1912
|
#
|
|
1880
1913
|
# :deprecated
|
|
1881
1914
|
# : Used for warning for deprecated functionality that may be removed in the
|
|
@@ -1901,7 +1934,7 @@ module Kernel : BasicObject
|
|
|
1901
1934
|
# * Invoking the executable at `exe_path`.
|
|
1902
1935
|
#
|
|
1903
1936
|
# This method has potential security vulnerabilities if called with untrusted
|
|
1904
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
1937
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
1905
1938
|
#
|
|
1906
1939
|
# The new process is created using the [exec system
|
|
1907
1940
|
# call](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/e
|
|
@@ -1920,7 +1953,7 @@ module Kernel : BasicObject
|
|
|
1920
1953
|
# word or special built-in, or if it contains one or more meta characters.
|
|
1921
1954
|
# * `exe_path` otherwise.
|
|
1922
1955
|
#
|
|
1923
|
-
#
|
|
1956
|
+
# <strong>Argument `command_line`</strong>
|
|
1924
1957
|
#
|
|
1925
1958
|
# String argument `command_line` is a command line to be passed to a shell; it
|
|
1926
1959
|
# must begin with a shell reserved word, begin with a special built-in, or
|
|
@@ -1943,7 +1976,7 @@ module Kernel : BasicObject
|
|
|
1943
1976
|
#
|
|
1944
1977
|
# Raises an exception if the new process could not execute.
|
|
1945
1978
|
#
|
|
1946
|
-
#
|
|
1979
|
+
# <strong>Argument `exe_path`</strong>
|
|
1947
1980
|
#
|
|
1948
1981
|
# Argument `exe_path` is one of the following:
|
|
1949
1982
|
#
|
|
@@ -1977,8 +2010,8 @@ module Kernel : BasicObject
|
|
|
1977
2010
|
#
|
|
1978
2011
|
# Raises an exception if the new process could not execute.
|
|
1979
2012
|
#
|
|
1980
|
-
def self?.exec: (String command, *String args, ?unsetenv_others:
|
|
1981
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others:
|
|
2013
|
+
def self?.exec: (String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> bot
|
|
2014
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> bot
|
|
1982
2015
|
|
|
1983
2016
|
type redirect_fd = Integer | :in | :out | :err | IO | String | [ String ] | [ String, string | int ] | [ String, string | int, int ] | [ :child, int ] | :close
|
|
1984
2017
|
|
|
@@ -1993,7 +2026,7 @@ module Kernel : BasicObject
|
|
|
1993
2026
|
# * Invoking the executable at `exe_path`.
|
|
1994
2027
|
#
|
|
1995
2028
|
# This method has potential security vulnerabilities if called with untrusted
|
|
1996
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2029
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
1997
2030
|
#
|
|
1998
2031
|
# Returns the process ID (pid) of the new process, without waiting for it to
|
|
1999
2032
|
# complete.
|
|
@@ -2020,7 +2053,7 @@ module Kernel : BasicObject
|
|
|
2020
2053
|
# word or special built-in, or if it contains one or more meta characters.
|
|
2021
2054
|
# * `exe_path` otherwise.
|
|
2022
2055
|
#
|
|
2023
|
-
#
|
|
2056
|
+
# <strong>Argument `command_line`</strong>
|
|
2024
2057
|
#
|
|
2025
2058
|
# String argument `command_line` is a command line to be passed to a shell; it
|
|
2026
2059
|
# must begin with a shell reserved word, begin with a special built-in, or
|
|
@@ -2049,7 +2082,7 @@ module Kernel : BasicObject
|
|
|
2049
2082
|
#
|
|
2050
2083
|
# Raises an exception if the new process could not execute.
|
|
2051
2084
|
#
|
|
2052
|
-
#
|
|
2085
|
+
# <strong>Argument `exe_path`</strong>
|
|
2053
2086
|
#
|
|
2054
2087
|
# Argument `exe_path` is one of the following:
|
|
2055
2088
|
#
|
|
@@ -2082,8 +2115,8 @@ module Kernel : BasicObject
|
|
|
2082
2115
|
#
|
|
2083
2116
|
# Raises an exception if the new process could not execute.
|
|
2084
2117
|
#
|
|
2085
|
-
def self?.spawn: (String command, *String args, ?unsetenv_others:
|
|
2086
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others:
|
|
2118
|
+
def self?.spawn: (String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> Integer
|
|
2119
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> Integer
|
|
2087
2120
|
|
|
2088
2121
|
# <!--
|
|
2089
2122
|
# rdoc-file=process.c
|
|
@@ -2096,7 +2129,7 @@ module Kernel : BasicObject
|
|
|
2096
2129
|
# * Invoking the executable at `exe_path`.
|
|
2097
2130
|
#
|
|
2098
2131
|
# This method has potential security vulnerabilities if called with untrusted
|
|
2099
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2132
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2100
2133
|
#
|
|
2101
2134
|
# Returns:
|
|
2102
2135
|
#
|
|
@@ -2107,7 +2140,7 @@ module Kernel : BasicObject
|
|
|
2107
2140
|
# Raises an exception (instead of returning `false` or `nil`) if keyword
|
|
2108
2141
|
# argument `exception` is set to `true`.
|
|
2109
2142
|
#
|
|
2110
|
-
# Assigns the command's error status to
|
|
2143
|
+
# Assigns the command's error status to <code>$?</code>.
|
|
2111
2144
|
#
|
|
2112
2145
|
# The new process is created using the [system system
|
|
2113
2146
|
# call](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/s
|
|
@@ -2126,7 +2159,7 @@ module Kernel : BasicObject
|
|
|
2126
2159
|
# word or special built-in, or if it contains one or more meta characters.
|
|
2127
2160
|
# * `exe_path` otherwise.
|
|
2128
2161
|
#
|
|
2129
|
-
#
|
|
2162
|
+
# <strong>Argument `command_line`</strong>
|
|
2130
2163
|
#
|
|
2131
2164
|
# String argument `command_line` is a command line to be passed to a shell; it
|
|
2132
2165
|
# must begin with a shell reserved word, begin with a special built-in, or
|
|
@@ -2138,7 +2171,7 @@ module Kernel : BasicObject
|
|
|
2138
2171
|
# system('date > /nop/date.tmp') # => false
|
|
2139
2172
|
# system('date > /nop/date.tmp', exception: true) # Raises RuntimeError.
|
|
2140
2173
|
#
|
|
2141
|
-
# Assigns the command's error status to
|
|
2174
|
+
# Assigns the command's error status to <code>$?</code>:
|
|
2142
2175
|
#
|
|
2143
2176
|
# system('exit') # => true # Built-in.
|
|
2144
2177
|
# $? # => #<Process::Status: pid 640610 exit 0>
|
|
@@ -2158,7 +2191,7 @@ module Kernel : BasicObject
|
|
|
2158
2191
|
#
|
|
2159
2192
|
# Raises an exception if the new process could not execute.
|
|
2160
2193
|
#
|
|
2161
|
-
#
|
|
2194
|
+
# <strong>Argument `exe_path`</strong>
|
|
2162
2195
|
#
|
|
2163
2196
|
# Argument `exe_path` is one of the following:
|
|
2164
2197
|
#
|
|
@@ -2175,7 +2208,7 @@ module Kernel : BasicObject
|
|
|
2175
2208
|
#
|
|
2176
2209
|
# Mon Aug 28 11:43:10 AM CDT 2023
|
|
2177
2210
|
#
|
|
2178
|
-
# Assigns the command's error status to
|
|
2211
|
+
# Assigns the command's error status to <code>$?</code>:
|
|
2179
2212
|
#
|
|
2180
2213
|
# system('/usr/bin/date') # => true
|
|
2181
2214
|
# $? # => #<Process::Status: pid 645605 exit 0>
|
|
@@ -2200,8 +2233,51 @@ module Kernel : BasicObject
|
|
|
2200
2233
|
#
|
|
2201
2234
|
# Raises an exception if the new process could not execute.
|
|
2202
2235
|
#
|
|
2203
|
-
def self?.system: (String command, *String args, ?unsetenv_others:
|
|
2204
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others:
|
|
2236
|
+
def self?.system: (String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String, ?exception: bool) -> (NilClass | FalseClass | TrueClass)
|
|
2237
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String, ?exception: bool) -> (NilClass | FalseClass | TrueClass)
|
|
2238
|
+
|
|
2239
|
+
# An interface used with `trace_var` (and `untrace_var`) for custom command types.
|
|
2240
|
+
interface _Tracer
|
|
2241
|
+
# Called whenever the global variable that's being traced changes; the argument is the new value.
|
|
2242
|
+
def call: (untyped argument) -> void
|
|
2243
|
+
end
|
|
2244
|
+
|
|
2245
|
+
# <!--
|
|
2246
|
+
# rdoc-file=eval.c
|
|
2247
|
+
# - trace_var(symbol, cmd ) -> nil
|
|
2248
|
+
# - trace_var(symbol) {|val| block } -> nil
|
|
2249
|
+
# -->
|
|
2250
|
+
# Controls tracing of assignments to global variables. The parameter `symbol`
|
|
2251
|
+
# identifies the variable (as either a string name or a symbol identifier).
|
|
2252
|
+
# *cmd* (which may be a string or a `Proc` object) or block is executed whenever
|
|
2253
|
+
# the variable is assigned. The block or `Proc` object receives the variable's
|
|
2254
|
+
# new value as a parameter. Also see #untrace_var.
|
|
2255
|
+
#
|
|
2256
|
+
# trace_var :$_, proc {|v| puts "$_ is now '#{v}'" }
|
|
2257
|
+
# $_ = "hello"
|
|
2258
|
+
# $_ = ' there'
|
|
2259
|
+
#
|
|
2260
|
+
# <em>produces:</em>
|
|
2261
|
+
#
|
|
2262
|
+
# $_ is now 'hello'
|
|
2263
|
+
# $_ is now ' there'
|
|
2264
|
+
#
|
|
2265
|
+
def self?.trace_var: (interned name, String | _Tracer cmd) -> nil
|
|
2266
|
+
| (interned name) { (untyped value) -> void } -> nil
|
|
2267
|
+
| (interned name, nil) -> Array[String | _Tracer]?
|
|
2268
|
+
|
|
2269
|
+
# <!--
|
|
2270
|
+
# rdoc-file=eval.c
|
|
2271
|
+
# - untrace_var(symbol [, cmd] ) -> array or nil
|
|
2272
|
+
# -->
|
|
2273
|
+
# Removes tracing for the specified command on the given global variable and
|
|
2274
|
+
# returns `nil`. If no command is specified, removes all tracing for that
|
|
2275
|
+
# variable and returns an array containing the commands actually removed.
|
|
2276
|
+
#
|
|
2277
|
+
def self?.untrace_var: (interned name, ?nil) -> Array[String | _Tracer]
|
|
2278
|
+
| (interned name, String cmd) -> [String]?
|
|
2279
|
+
| [T < _Tracer] (interned name, T cmd) -> [T]?
|
|
2280
|
+
| (interned name, untyped cmd) -> nil
|
|
2205
2281
|
|
|
2206
2282
|
# <!--
|
|
2207
2283
|
# rdoc-file=object.c
|
|
@@ -2248,8 +2324,8 @@ module Kernel : BasicObject
|
|
|
2248
2324
|
# -->
|
|
2249
2325
|
# Produces a shallow copy of *obj*---the instance variables of *obj* are copied,
|
|
2250
2326
|
# but not the objects they reference. #clone copies the frozen value state of
|
|
2251
|
-
# *obj*, unless the
|
|
2252
|
-
# value. See also the discussion under Object#dup.
|
|
2327
|
+
# *obj*, unless the <code>:freeze</code> keyword argument is given with a false
|
|
2328
|
+
# or true value. See also the discussion under Object#dup.
|
|
2253
2329
|
#
|
|
2254
2330
|
# class Klass
|
|
2255
2331
|
# attr_accessor :str
|