rbs 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +10 -4
- data/CHANGELOG.md +22 -0
- data/Gemfile +7 -2
- data/README.md +1 -1
- data/Rakefile +3 -4
- data/bin/test_runner.rb +4 -5
- data/core/encoding.rbs +1 -1
- data/core/file.rbs +1 -0
- data/core/io.rbs +75 -4
- data/core/kernel.rbs +56 -56
- data/core/module.rbs +2 -2
- data/core/unbound_method.rbs +16 -0
- data/docs/CONTRIBUTING.md +2 -2
- data/docs/stdlib.md +50 -12
- data/goodcheck.yml +1 -1
- data/lib/rbs/definition_builder.rb +24 -20
- data/lib/rbs/parser.rb +347 -333
- data/lib/rbs/parser.y +12 -2
- data/lib/rbs/prototype/rb.rb +14 -4
- data/lib/rbs/test/setup_helper.rb +0 -1
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +1 -0
- data/sig/definition_builder.rbs +3 -2
- data/stdlib/fileutils/0/fileutils.rbs +585 -0
- data/stdlib/pathname/0/pathname.rbs +1 -1
- data/stdlib/prettyprint/0/prettyprint.rbs +366 -0
- data/stdlib/uri/0/common.rbs +1 -1
- metadata +6 -5
- data/core/data.rbs +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d03121b9d58454590a45862ba1d479305feae4f2b4d10707ae8e1a3c24d4aba
|
4
|
+
data.tar.gz: f147d99859cfc7e18b41a751587f7b2cba484bf397d5b306b9fe69f15dd4b452
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e325492bc73b6d9f2f62660c4e4821f7d3853780f39a957e02ad4b30fc44ca1e687fbde9d0b2843be786e51126fbb5473e1d5ae5c9c719f255bfc50fe2f7cde
|
7
|
+
data.tar.gz: '03995c9d63b9db359744338497985952eed7608729cb4a259b20af6e68de5eecdf3c996404701e2821f35d4bebfdb1e2c7c8e6289f9b5a7875fd4c6c507bde27'
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,8 +12,8 @@ jobs:
|
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
14
|
container_tag:
|
15
|
-
- master-nightly-
|
16
|
-
-
|
15
|
+
- master-nightly-focal
|
16
|
+
- 3.0-focal
|
17
17
|
- 2.7-bionic
|
18
18
|
job:
|
19
19
|
- test
|
@@ -27,12 +27,18 @@ jobs:
|
|
27
27
|
run: |
|
28
28
|
apt-get update
|
29
29
|
apt-get install -y libdb-dev
|
30
|
-
- name: Install
|
30
|
+
- name: Install bundler
|
31
31
|
run: |
|
32
32
|
ruby -v
|
33
33
|
gem install bundler
|
34
|
+
- name: bundle config set with
|
35
|
+
run: |
|
36
|
+
echo "NO_MINITEST=true" >> $GITHUB_ENV
|
37
|
+
bundle config set --local without 'minitest'
|
38
|
+
if: "contains(matrix.container_tag, 'master-nightly')"
|
39
|
+
- name: bin/setup
|
40
|
+
run: |
|
34
41
|
bin/setup
|
35
42
|
- name: Run test
|
36
43
|
run: |
|
37
44
|
bundle exec rake ${{ matrix.job }}
|
38
|
-
if: "!(matrix.job == 'stdlib_test' && contains(matrix.container_tag, '2.6'))"
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,28 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.0.1 (2021-01-27)
|
6
|
+
|
7
|
+
* Signature Updates
|
8
|
+
* PrettyPrint ([\#573](https://github.com/ruby/rbs/pull/573))
|
9
|
+
* FileUtils ([\#576](https://github.com/ruby/rbs/pull/576))
|
10
|
+
* UnboundMethod ([\#555](https://github.com/ruby/rbs/pull/555))
|
11
|
+
* IO ([\#571](https://github.com/ruby/rbs/pull/571))
|
12
|
+
* Kernel ([\#549](https://github.com/ruby/rbs/pull/549), [\#569](https://github.com/ruby/rbs/pull/569))
|
13
|
+
* File ([\#552](https://github.com/ruby/rbs/pull/552))
|
14
|
+
* Data is removed ([\#570](https://github.com/ruby/rbs/pull/570))
|
15
|
+
* Module ([\#568](https://github.com/ruby/rbs/pull/568))
|
16
|
+
* Object ([\#557](https://github.com/ruby/rbs/pull/557))
|
17
|
+
* Renew test sample code ([#581](https://github.com/ruby/rbs/pull/581))
|
18
|
+
* Add description to `generate:stdlib_test` Rake task ([\#578](https://github.com/ruby/rbs/pull/578))
|
19
|
+
* Declare supported ruby version >= 2.6 ([\#548](https://github.com/ruby/rbs/pull/548))
|
20
|
+
* Fix module self-type override ([\#577](https://github.com/ruby/rbs/pull/577))
|
21
|
+
* Fix parser to support all operator symbols ([\#550](https://github.com/ruby/rbs/pull/550))
|
22
|
+
* Migrate from Minitest to Test::Unit ([\#556](https://github.com/ruby/rbs/pull/556))
|
23
|
+
* Fix type alias parsing ([\#565](https://github.com/ruby/rbs/pull/565))
|
24
|
+
* Support end-less method definition in `prototype rb` ([\#561](https://github.com/ruby/rbs/pull/561))
|
25
|
+
* Support method argument forwarding in `prototype rb` ([\#560](https://github.com/ruby/rbs/pull/560))
|
26
|
+
|
5
27
|
## 1.0.0 (2020-12-24)
|
6
28
|
|
7
29
|
* Signature updates for `URI`, `IO`, `File`, `Pathname`, `Module`, and `Time` ([#529](https://github.com/ruby/rbs/pull/529), [#521](https://github.com/ruby/rbs/pull/521), [#520](https://github.com/ruby/rbs/pull/520), [#511](https://github.com/ruby/rbs/pull/511), [#517](https://github.com/ruby/rbs/pull/517), [#542](https://github.com/ruby/rbs/pull/542), [#546](https://github.com/ruby/rbs/pull/546), [#540](https://github.com/ruby/rbs/pull/540), [#538](https://github.com/ruby/rbs/pull/538))
|
data/Gemfile
CHANGED
@@ -5,12 +5,12 @@ gemspec
|
|
5
5
|
|
6
6
|
# Development dependencies
|
7
7
|
gem "rake"
|
8
|
-
gem "
|
8
|
+
gem "test-unit"
|
9
|
+
gem "test-unit-rr"
|
9
10
|
gem "rspec"
|
10
11
|
gem "racc"
|
11
12
|
gem "rubocop"
|
12
13
|
gem "rubocop-rubycw"
|
13
|
-
gem "minitest-reporters"
|
14
14
|
gem "json"
|
15
15
|
gem "json-schema"
|
16
16
|
gem 'stackprof'
|
@@ -22,4 +22,9 @@ gem "rbs-amber", path: "test/assets/test-gem"
|
|
22
22
|
|
23
23
|
group :ide, optional: true do
|
24
24
|
gem "ruby-debug-ide"
|
25
|
+
gem "debase", ">= 0.2.5.beta2"
|
26
|
+
end
|
27
|
+
|
28
|
+
group :minitest do
|
29
|
+
gem "minitest"
|
25
30
|
end
|
data/README.md
CHANGED
@@ -107,7 +107,7 @@ instance = builder.build_instance(string)
|
|
107
107
|
|
108
108
|
# Print the types of `gsub` method:
|
109
109
|
puts instance.methods[:gsub].method_types.join("\n")
|
110
|
-
#
|
110
|
+
# Outputs =>
|
111
111
|
# (::Regexp | ::string pattern, ::string replacement) -> ::String
|
112
112
|
# (::Regexp | ::string pattern, ::Hash[::String, ::String] hash) -> ::String
|
113
113
|
# (::Regexp | ::string pattern) { (::String match) -> ::_ToS } -> ::String
|
data/Rakefile
CHANGED
@@ -28,8 +28,6 @@ task :validate => :parser do
|
|
28
28
|
sh "#{ruby} #{rbs} validate --silent"
|
29
29
|
|
30
30
|
FileList["stdlib/*"].each do |path|
|
31
|
-
next if path =~ %r{stdlib/builtin}
|
32
|
-
|
33
31
|
lib = [File.basename(path).to_s]
|
34
32
|
|
35
33
|
if lib == ["bigdecimal-math"]
|
@@ -84,6 +82,7 @@ task :confirm_parser do
|
|
84
82
|
end
|
85
83
|
|
86
84
|
namespace :generate do
|
85
|
+
desc "Generate a test file for a stdlib class signatures"
|
87
86
|
task :stdlib_test, [:class] do |_task, args|
|
88
87
|
klass = args.fetch(:class) do
|
89
88
|
raise "Class name is necessary. e.g. rake 'generate:stdlib_test[String]'"
|
@@ -115,7 +114,7 @@ namespace :generate do
|
|
115
114
|
require_relative "test_helper"
|
116
115
|
|
117
116
|
<%- unless class_methods.empty? -%>
|
118
|
-
class <%= klass %>SingletonTest <
|
117
|
+
class <%= klass %>SingletonTest < Test::Unit::TestCase
|
119
118
|
include TypeAssertions
|
120
119
|
|
121
120
|
# library "pathname", "set", "securerandom" # Declare library signatures to load
|
@@ -133,7 +132,7 @@ namespace :generate do
|
|
133
132
|
<%- end -%>
|
134
133
|
|
135
134
|
<%- unless instance_methods.empty? -%>
|
136
|
-
class <%= klass %>Test <
|
135
|
+
class <%= klass %>Test < Test::Unit::TestCase
|
137
136
|
include TypeAssertions
|
138
137
|
|
139
138
|
# library "pathname", "set", "securerandom" # Declare library signatures to load
|
data/bin/test_runner.rb
CHANGED
@@ -4,13 +4,12 @@ $LOAD_PATH << File.join(__dir__, "../lib")
|
|
4
4
|
|
5
5
|
require "set"
|
6
6
|
|
7
|
-
|
8
|
-
Gem::Version.new('
|
9
|
-
ruby_version <= Gem::Version.new('2.8.0')
|
7
|
+
IS_LATEST_RUBY = Gem::Version.new(RUBY_VERSION).yield_self do |ruby_version|
|
8
|
+
Gem::Version.new('3.0.0') <= ruby_version && ruby_version < Gem::Version.new('3.1.0')
|
10
9
|
end
|
11
10
|
|
12
|
-
unless
|
13
|
-
STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby
|
11
|
+
unless IS_LATEST_RUBY
|
12
|
+
STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby 3.0 but RUBY_VERSION==#{RUBY_VERSION} ⚠️⚠️⚠️⚠️"
|
14
13
|
end
|
15
14
|
|
16
15
|
KNOWN_FAILS = %w(dbm).map do |lib|
|
data/core/encoding.rbs
CHANGED
data/core/file.rbs
CHANGED
@@ -533,6 +533,7 @@ class File < IO
|
|
533
533
|
|
534
534
|
# Alias of `File.new`.
|
535
535
|
def self.open: (string | _ToPath | int file_name, ?(string | int) mode, ?int perm) -> instance
|
536
|
+
| [T] (string | _ToPath | int file_name, ?(string | int) mode, ?int perm) { (File) -> T } -> T
|
536
537
|
|
537
538
|
# Returns `true` if the named file exists and the effective used id of the
|
538
539
|
# calling process is the owner of the file.
|
data/core/io.rbs
CHANGED
@@ -107,14 +107,85 @@ class IO < Object
|
|
107
107
|
|
108
108
|
include Enumerable[String]
|
109
109
|
|
110
|
-
|
110
|
+
# String Output---Writes *obj* to *ios*. *obj* will be converted to a string
|
111
|
+
# using `to_s`.
|
112
|
+
#
|
113
|
+
# $stdout << "Hello " << "world!\n"
|
114
|
+
#
|
115
|
+
# *produces:*
|
116
|
+
#
|
117
|
+
# Hello world!
|
118
|
+
#
|
119
|
+
def <<: (_ToS obj) -> self
|
111
120
|
|
112
|
-
|
121
|
+
# Announce an intention to access data from the current file in a specific
|
122
|
+
# pattern. On platforms that do not support the *posix_fadvise(2)* system call,
|
123
|
+
# this method is a no-op.
|
124
|
+
#
|
125
|
+
# *advice* is one of the following symbols:
|
126
|
+
#
|
127
|
+
# :normal
|
128
|
+
# : No advice to give; the default assumption for an open file.
|
129
|
+
# :sequential
|
130
|
+
# : The data will be accessed sequentially with lower offsets read before
|
131
|
+
# higher ones.
|
132
|
+
# :random
|
133
|
+
# : The data will be accessed in random order.
|
134
|
+
# :willneed
|
135
|
+
# : The data will be accessed in the near future.
|
136
|
+
# :dontneed
|
137
|
+
# : The data will not be accessed in the near future.
|
138
|
+
# :noreuse
|
139
|
+
# : The data will only be accessed once.
|
140
|
+
#
|
141
|
+
#
|
142
|
+
# The semantics of a piece of advice are platform-dependent. See *man 2
|
143
|
+
# posix_fadvise* for details.
|
144
|
+
#
|
145
|
+
# "data" means the region of the current file that begins at *offset* and
|
146
|
+
# extends for *len* bytes. If *len* is 0, the region ends at the last byte of
|
147
|
+
# the file. By default, both *offset* and *len* are 0, meaning that the advice
|
148
|
+
# applies to the entire file.
|
149
|
+
#
|
150
|
+
# If an error occurs, one of the following exceptions will be raised:
|
151
|
+
#
|
152
|
+
# IOError
|
153
|
+
# : The IO stream is closed.
|
154
|
+
# Errno::EBADF
|
155
|
+
# : The file descriptor of the current file is invalid.
|
156
|
+
# Errno::EINVAL
|
157
|
+
# : An invalid value for *advice* was given.
|
158
|
+
# Errno::ESPIPE
|
159
|
+
# : The file descriptor of the current file refers to a FIFO or pipe. (Linux
|
160
|
+
# raises Errno::EINVAL in this case).
|
161
|
+
# TypeError
|
162
|
+
# : Either *advice* was not a Symbol, or one of the other arguments was not an
|
163
|
+
# Integer.
|
164
|
+
# RangeError
|
165
|
+
# : One of the arguments given was too big/small.
|
166
|
+
#
|
167
|
+
# This list is not exhaustive; other Errno
|
168
|
+
# : exceptions are also possible.
|
169
|
+
#
|
170
|
+
def advise: ((:normal | :sequential | :random | :willneed | :dontneed | :noreuse) advise, ?Integer offset, ?Integer len) -> nil
|
113
171
|
|
114
|
-
|
172
|
+
# Sets auto-close flag.
|
173
|
+
#
|
174
|
+
# f = open("/dev/null")
|
175
|
+
# IO.for_fd(f.fileno)
|
176
|
+
# # ...
|
177
|
+
# f.gets # may cause Errno::EBADF
|
178
|
+
#
|
179
|
+
# f = open("/dev/null")
|
180
|
+
# IO.for_fd(f.fileno).autoclose = false
|
181
|
+
# # ...
|
182
|
+
# f.gets # won't cause Errno::EBADF
|
183
|
+
#
|
184
|
+
def autoclose=: (bool) -> bool
|
115
185
|
|
116
186
|
# Returns `true` if the underlying file descriptor of *ios* will be closed
|
117
|
-
# automatically at its finalization, otherwise `false
|
187
|
+
# automatically at its finalization, otherwise `false`.
|
188
|
+
#
|
118
189
|
def autoclose?: () -> bool
|
119
190
|
|
120
191
|
# Puts *ios* into binary mode. Once a stream is in binary mode, it cannot
|
data/core/kernel.rbs
CHANGED
@@ -13,14 +13,14 @@
|
|
13
13
|
module Kernel : BasicObject
|
14
14
|
private
|
15
15
|
|
16
|
-
def caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
|
16
|
+
def self?.caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
|
17
17
|
| (?::Range[Integer] start_or_range) -> ::Array[String]?
|
18
18
|
| () -> ::Array[String]
|
19
19
|
|
20
|
-
def caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
|
20
|
+
def self?.caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
|
21
21
|
| (?::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
|
22
22
|
|
23
|
-
def catch: [T] (T tag) { (T tag) -> untyped } -> untyped
|
23
|
+
def self?.catch: [T] (T tag) { (T tag) -> untyped } -> untyped
|
24
24
|
| () { (Object tag) -> untyped } -> untyped
|
25
25
|
|
26
26
|
# In a perfect world this should be:
|
@@ -38,10 +38,9 @@ module Kernel : BasicObject
|
|
38
38
|
def define_singleton_method: (Symbol | String symbol, ?Proc | Method | UnboundMethod method) -> Symbol
|
39
39
|
| (Symbol | String symbol) { () -> untyped } -> Symbol
|
40
40
|
|
41
|
-
def eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
|
41
|
+
def self?.eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
|
42
42
|
|
43
43
|
# Returns `true` if `yield` would execute a block in the current context.
|
44
|
-
# The `iterator?` form is mildly deprecated.
|
45
44
|
#
|
46
45
|
# ```ruby
|
47
46
|
# def try
|
@@ -55,8 +54,7 @@ module Kernel : BasicObject
|
|
55
54
|
# try { "hello" } #=> "hello"
|
56
55
|
# try do "hello" end #=> "hello"
|
57
56
|
# ```
|
58
|
-
def
|
59
|
-
alias block_given? iterator?
|
57
|
+
def self.block_given?: () -> bool
|
60
58
|
|
61
59
|
# Returns the names of the current local variables.
|
62
60
|
#
|
@@ -67,9 +65,9 @@ module Kernel : BasicObject
|
|
67
65
|
# end
|
68
66
|
# local_variables #=> [:fred, :i]
|
69
67
|
# ```
|
70
|
-
def local_variables: () -> ::Array[Symbol]
|
68
|
+
def self?.local_variables: () -> ::Array[Symbol]
|
71
69
|
|
72
|
-
def srand: (?Numeric number) -> Numeric
|
70
|
+
def self?.srand: (?Numeric number) -> Numeric
|
73
71
|
|
74
72
|
# Creates a subprocess. If a block is specified, that block is run in the
|
75
73
|
# subprocess, and the subprocess terminates with a status of zero.
|
@@ -88,7 +86,7 @@ module Kernel : BasicObject
|
|
88
86
|
#
|
89
87
|
# Note that fork(2) is not available on some platforms like Windows and
|
90
88
|
# NetBSD 4. Therefore you should use spawn() instead of fork().
|
91
|
-
def fork: () -> Integer?
|
89
|
+
def self?.fork: () -> Integer?
|
92
90
|
| () { () -> untyped } -> Integer?
|
93
91
|
|
94
92
|
def initialize_copy: (self object) -> self
|
@@ -112,50 +110,50 @@ module Kernel : BasicObject
|
|
112
110
|
# Array(nil) #=> []
|
113
111
|
# Array(1) #=> [1]
|
114
112
|
# ```
|
115
|
-
def Array: (NilClass x) -> [ ]
|
113
|
+
def self?.Array: (NilClass x) -> [ ]
|
116
114
|
| [T] (::Array[T] x) -> ::Array[T]
|
117
115
|
| [T] (::Range[T] x) -> ::Array[T]
|
118
116
|
| [K, V] (::Hash[K, V] x) -> ::Array[[K, V]]
|
119
117
|
| [T] (T x) -> ::Array[T]
|
120
118
|
|
121
|
-
def Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
|
119
|
+
def self?.Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
|
122
120
|
|
123
|
-
def Float: (Numeric | String x, ?exception: bool exception) -> Float
|
121
|
+
def self?.Float: (Numeric | String x, ?exception: bool exception) -> Float
|
124
122
|
|
125
|
-
def Hash: [K, V] (Object x) -> ::Hash[K, V]
|
123
|
+
def self?.Hash: [K, V] (Object x) -> ::Hash[K, V]
|
126
124
|
|
127
|
-
def Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
|
125
|
+
def self?.Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
|
128
126
|
| (String arg, ?Integer base, ?exception: bool exception) -> Integer
|
129
127
|
|
130
|
-
def Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
|
128
|
+
def self?.Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
|
131
129
|
|
132
|
-
def String: (Object x) -> String
|
130
|
+
def self?.String: (Object x) -> String
|
133
131
|
|
134
132
|
# Returns the called name of the current method as a
|
135
133
|
# [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
|
136
134
|
# outside of a method, it returns `nil` .
|
137
|
-
def __callee__: () -> Symbol?
|
135
|
+
def self?.__callee__: () -> Symbol?
|
138
136
|
|
139
137
|
# Returns the canonicalized absolute path of the directory of the file
|
140
138
|
# from which this method is called. It means symlinks in the path is
|
141
139
|
# resolved. If `__FILE__` is `nil`, it returns `nil` . The return value
|
142
140
|
# equals to `File.dirname(File.realpath(__FILE__))` .
|
143
|
-
def __dir__: () -> String?
|
141
|
+
def self?.__dir__: () -> String?
|
144
142
|
|
145
143
|
# Returns the name at the definition of the current method as a
|
146
144
|
# [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
|
147
145
|
# outside of a method, it returns `nil` .
|
148
|
-
def __method__: () -> Symbol?
|
146
|
+
def self?.__method__: () -> Symbol?
|
149
147
|
|
150
|
-
def
|
148
|
+
def self?.`: (String arg0) -> String
|
151
149
|
|
152
|
-
def abort: (?String msg) -> bot
|
150
|
+
def self?.abort: (?String msg) -> bot
|
153
151
|
|
154
|
-
def at_exit: () { () -> untyped } -> Proc
|
152
|
+
def self?.at_exit: () { () -> untyped } -> Proc
|
155
153
|
|
156
|
-
def autoload: (String | Symbol _module, String filename) -> NilClass
|
154
|
+
def self?.autoload: (String | Symbol _module, String filename) -> NilClass
|
157
155
|
|
158
|
-
def autoload?: (Symbol | String name) -> String?
|
156
|
+
def self?.autoload?: (Symbol | String name) -> String?
|
159
157
|
|
160
158
|
# Returns a `Binding` object, describing the variable and method bindings
|
161
159
|
# at the point of call. This object can be used when calling `eval` to
|
@@ -169,7 +167,7 @@ module Kernel : BasicObject
|
|
169
167
|
# b = get_binding("hello")
|
170
168
|
# eval("param", b) #=> "hello"
|
171
169
|
# ```
|
172
|
-
def binding: () -> Binding
|
170
|
+
def self?.binding: () -> Binding
|
173
171
|
|
174
172
|
# Initiates the termination of the Ruby script by raising the `SystemExit`
|
175
173
|
# exception. This exception may be caught. The optional parameter is used
|
@@ -207,10 +205,10 @@ module Kernel : BasicObject
|
|
207
205
|
#
|
208
206
|
# at_exit function
|
209
207
|
# in finalizer
|
210
|
-
def exit: () -> bot
|
208
|
+
def self?.exit: () -> bot
|
211
209
|
| (?Integer | TrueClass | FalseClass status) -> bot
|
212
210
|
|
213
|
-
def exit!: (Integer | TrueClass | FalseClass status) -> bot
|
211
|
+
def self?.exit!: (Integer | TrueClass | FalseClass status) -> bot
|
214
212
|
|
215
213
|
# With no arguments, raises the exception in `$!` or raises a
|
216
214
|
# `RuntimeError` if `$!` is `nil` . With a single `String` argument,
|
@@ -230,24 +228,26 @@ module Kernel : BasicObject
|
|
230
228
|
# “current” exception ( `$!` ) if any. An alternative value, either an
|
231
229
|
# `Exception` object or `nil`, can be specified via the `:cause`
|
232
230
|
# argument.
|
233
|
-
def fail: () -> bot
|
231
|
+
def self?.fail: () -> bot
|
234
232
|
| (String arg0) -> bot
|
235
233
|
| (_Exception arg0, ?untyped arg1, ?::Array[String] arg2) -> bot
|
236
234
|
alias raise fail
|
235
|
+
alias self.raise self.fail
|
237
236
|
|
238
|
-
def format: (String format, *untyped args) -> String
|
237
|
+
def self?.format: (String format, *untyped args) -> String
|
239
238
|
alias sprintf format
|
239
|
+
alias self.sprintf self.format
|
240
240
|
|
241
|
-
def gets: (?String arg0, ?Integer arg1) -> String?
|
241
|
+
def self?.gets: (?String arg0, ?Integer arg1) -> String?
|
242
242
|
|
243
243
|
# Returns an array of the names of global variables.
|
244
244
|
#
|
245
245
|
# ```ruby
|
246
246
|
# global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
|
247
247
|
# ```
|
248
|
-
def global_variables: () -> ::Array[Symbol]
|
248
|
+
def self?.global_variables: () -> ::Array[Symbol]
|
249
249
|
|
250
|
-
def load: (String filename, ?boolish) -> bool
|
250
|
+
def self?.load: (String filename, ?boolish) -> bool
|
251
251
|
|
252
252
|
# Repeatedly executes the block.
|
253
253
|
#
|
@@ -277,10 +277,10 @@ module Kernel : BasicObject
|
|
277
277
|
# puts enum.next
|
278
278
|
# } #=> :ok
|
279
279
|
# ```
|
280
|
-
def loop: () { (nil) -> untyped } -> bot
|
280
|
+
def self?.loop: () { (nil) -> untyped } -> bot
|
281
281
|
| () -> ::Enumerator[nil, bot]
|
282
282
|
|
283
|
-
def open: (String name, ?String mode, ?Integer perm) -> IO?
|
283
|
+
def self?.open: (String name, ?String mode, ?Integer perm) -> IO?
|
284
284
|
| [T] (String name, ?String mode, ?Integer perm) { (IO) -> T } -> T
|
285
285
|
|
286
286
|
# Prints each object in turn to `$stdout` . If the output field separator
|
@@ -300,25 +300,25 @@ module Kernel : BasicObject
|
|
300
300
|
#
|
301
301
|
# cat12399
|
302
302
|
# cat, 1, 2, 3, 99
|
303
|
-
def print: (*Kernel args) -> nil
|
303
|
+
def self?.print: (*Kernel args) -> nil
|
304
304
|
|
305
|
-
def printf: (IO arg0, String arg1, *untyped args) -> nil
|
305
|
+
def self?.printf: (IO arg0, String arg1, *untyped args) -> nil
|
306
306
|
| (String arg1, *untyped args) -> nil
|
307
307
|
| -> nil
|
308
308
|
|
309
|
-
def proc: () { () -> untyped } -> Proc
|
309
|
+
def self?.proc: () { () -> untyped } -> Proc
|
310
310
|
|
311
|
-
def lambda: () { () -> untyped } -> Proc
|
311
|
+
def self?.lambda: () { () -> untyped } -> Proc
|
312
312
|
|
313
|
-
def putc: (Integer arg0) -> Integer
|
313
|
+
def self?.putc: (Integer arg0) -> Integer
|
314
314
|
| (String arg0) -> String
|
315
315
|
|
316
|
-
def puts: (*untyped arg0) -> NilClass
|
316
|
+
def self?.puts: (*untyped arg0) -> NilClass
|
317
317
|
|
318
|
-
def p: [T] (T arg0) -> T
|
318
|
+
def self?.p: [T] (T arg0) -> T
|
319
319
|
| (*untyped arg0) -> Array[untyped]
|
320
320
|
|
321
|
-
def pp: [T] (T arg0) -> T
|
321
|
+
def self?.pp: [T] (T arg0) -> T
|
322
322
|
| (*untyped arg0) -> Array[untyped]
|
323
323
|
|
324
324
|
# If called without an argument, or if `max.to_i.abs == 0`, rand returns
|
@@ -356,31 +356,31 @@ module Kernel : BasicObject
|
|
356
356
|
# See also
|
357
357
|
# [Random\#rand](https://ruby-doc.org/core-2.6.3/Random.html#method-i-rand)
|
358
358
|
# .
|
359
|
-
def rand: () -> Float
|
359
|
+
def self?.rand: () -> Float
|
360
360
|
| (Integer arg0) -> Integer
|
361
361
|
| (::Range[Integer] arg0) -> Integer
|
362
362
|
| (::Range[Float] arg0) -> Float
|
363
363
|
|
364
|
-
def readline: (?String arg0, ?Integer arg1) -> String
|
364
|
+
def self?.readline: (?String arg0, ?Integer arg1) -> String
|
365
365
|
|
366
|
-
def readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
|
366
|
+
def self?.readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
|
367
367
|
|
368
|
-
def require: (String path) -> bool
|
368
|
+
def self?.require: (String path) -> bool
|
369
369
|
|
370
|
-
def require_relative: (String feature) -> bool
|
370
|
+
def self?.require_relative: (String feature) -> bool
|
371
371
|
|
372
|
-
def select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
|
372
|
+
def self?.select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
|
373
373
|
|
374
|
-
def sleep: () -> bot
|
374
|
+
def self?.sleep: () -> bot
|
375
375
|
| (Numeric duration) -> Integer
|
376
376
|
|
377
|
-
def syscall: (Integer num, *untyped args) -> untyped
|
377
|
+
def self?.syscall: (Integer num, *untyped args) -> untyped
|
378
378
|
|
379
|
-
def test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
|
379
|
+
def self?.test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
|
380
380
|
|
381
|
-
def throw: (Object tag, ?untyped obj) -> bot
|
381
|
+
def self?.throw: (Object tag, ?untyped obj) -> bot
|
382
382
|
|
383
|
-
def warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
|
383
|
+
def self?.warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
|
384
384
|
|
385
385
|
# Replaces the current process by running the given external *command* ,
|
386
386
|
# which can take one of the following forms:
|
@@ -461,7 +461,7 @@ module Kernel : BasicObject
|
|
461
461
|
# exec "echo", "*" # echoes an asterisk
|
462
462
|
# # never get here
|
463
463
|
# ```
|
464
|
-
def exec: (*String args) -> bot
|
464
|
+
def self?.exec: (*String args) -> bot
|
465
465
|
|
466
466
|
# Executes *command…* in a subshell. *command…* is one of following forms.
|
467
467
|
#
|
@@ -488,7 +488,7 @@ module Kernel : BasicObject
|
|
488
488
|
# *
|
489
489
|
#
|
490
490
|
# See `Kernel.exec` for the standard shell.
|
491
|
-
def system: (*String args) -> (NilClass | FalseClass | TrueClass)
|
491
|
+
def self?.system: (*String args) -> (NilClass | FalseClass | TrueClass)
|
492
492
|
end
|
493
493
|
|
494
494
|
Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped
|