rbs 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +10 -4
- data/CHANGELOG.md +47 -0
- data/Gemfile +6 -2
- data/README.md +1 -1
- data/Rakefile +3 -4
- data/bin/test_runner.rb +4 -5
- data/core/array.rbs +2 -2
- data/core/complex.rbs +1 -1
- data/core/encoding.rbs +1 -1
- data/core/enumerable.rbs +15 -1
- data/core/file.rbs +3 -1
- data/core/integer.rbs +2 -1
- data/core/io.rbs +75 -4
- data/core/kernel.rbs +56 -56
- data/core/module.rbs +3 -3
- data/core/rational.rbs +2 -1
- data/core/string.rbs +2 -1
- data/core/symbol.rbs +2 -1
- data/core/time.rbs +2 -1
- 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/ast/members.rb +13 -0
- data/lib/rbs/definition_builder.rb +36 -25
- data/lib/rbs/definition_builder/method_builder.rb +9 -2
- data/lib/rbs/errors.rb +3 -0
- 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/sig/members.rbs +2 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
- data/stdlib/date/0/date.rbs +1 -1
- data/stdlib/fileutils/0/fileutils.rbs +585 -0
- data/stdlib/json/0/json.rbs +64 -0
- data/stdlib/pathname/0/pathname.rbs +3 -2
- data/stdlib/prettyprint/0/prettyprint.rbs +366 -0
- data/stdlib/set/0/set.rbs +7 -0
- data/stdlib/timeout/0/timeout.rbs +57 -0
- data/stdlib/uri/0/common.rbs +1 -1
- data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
- data/steep/Gemfile.lock +17 -19
- metadata +7 -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: 96101c70eb61ad35fb0589861eb35f96a194b9de0e6e0f879237f3c5afea2a60
|
4
|
+
data.tar.gz: 8ca6a02529d655a6c4099b5f9da6ff63ec09159c8fcf2d4a43f60a615aa6b44d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffeed46652774774276a0efb9285b53b979fefa0bbf1fd6bdd8aba7fd76172f352313acdfaca64c89dd63332aa346d87785c56b8ff5e8911bf0228a22d8cf5c2
|
7
|
+
data.tar.gz: 4c6bce345c37c5b76b1563a204a7334cbaf99a1e4b34ac2fb88edcf143a1f67d91fef1f3fa16112faa403e644556c92154fa23a7f3c8bcdd45190fc4f042a369
|
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,53 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.0.5 (2021-02-13)
|
6
|
+
|
7
|
+
* Signature Updates
|
8
|
+
* Enumerable ([\#596](https://github.com/ruby/rbs/pull/596))
|
9
|
+
* Set ([\#595](https://github.com/ruby/rbs/pull/595))
|
10
|
+
* `#to_json` ([\#592](https://github.com/ruby/rbs/pull/592))
|
11
|
+
* `<=>` ([\#593](https://github.com/ruby/rbs/pull/593))
|
12
|
+
* Timeout ([\#586](https://github.com/ruby/rbs/pull/586))
|
13
|
+
* URI::RFC2396_Parser ([\#587](https://github.com/ruby/rbs/pull/587))
|
14
|
+
* Rename generic class parameters on re-open ([\#594](https://github.com/ruby/rbs/pull/594))
|
15
|
+
* Make `refute_send_type` check that method call doesn't match with types in RBS ([\#588](https://github.com/ruby/rbs/pull/588))
|
16
|
+
|
17
|
+
## 1.0.4 (2021-01-31)
|
18
|
+
|
19
|
+
* Unbundle `rr` to run test in `ruby/ruby` repo ([#585](https://github.com/ruby/rbs/pull/585))
|
20
|
+
|
21
|
+
## 1.0.3 (2021-01-28)
|
22
|
+
|
23
|
+
* Set up `#ancestors` and `#location` of `RecursiveAncestorError` ([#583](https://github.com/ruby/rbs/pull/583))
|
24
|
+
|
25
|
+
## 1.0.2 (2021-01-28)
|
26
|
+
|
27
|
+
* Signature Updates
|
28
|
+
* Kernel([#582](https://github.com/ruby/rbs/pull/582))
|
29
|
+
|
30
|
+
## 1.0.1 (2021-01-27)
|
31
|
+
|
32
|
+
* Signature Updates
|
33
|
+
* PrettyPrint ([\#573](https://github.com/ruby/rbs/pull/573))
|
34
|
+
* FileUtils ([\#576](https://github.com/ruby/rbs/pull/576))
|
35
|
+
* UnboundMethod ([\#555](https://github.com/ruby/rbs/pull/555))
|
36
|
+
* IO ([\#571](https://github.com/ruby/rbs/pull/571))
|
37
|
+
* Kernel ([\#549](https://github.com/ruby/rbs/pull/549), [\#569](https://github.com/ruby/rbs/pull/569))
|
38
|
+
* File ([\#552](https://github.com/ruby/rbs/pull/552))
|
39
|
+
* Data is removed ([\#570](https://github.com/ruby/rbs/pull/570))
|
40
|
+
* Module ([\#568](https://github.com/ruby/rbs/pull/568))
|
41
|
+
* Object ([\#557](https://github.com/ruby/rbs/pull/557))
|
42
|
+
* Renew test sample code ([#581](https://github.com/ruby/rbs/pull/581))
|
43
|
+
* Add description to `generate:stdlib_test` Rake task ([\#578](https://github.com/ruby/rbs/pull/578))
|
44
|
+
* Declare supported ruby version >= 2.6 ([\#548](https://github.com/ruby/rbs/pull/548))
|
45
|
+
* Fix module self-type override ([\#577](https://github.com/ruby/rbs/pull/577))
|
46
|
+
* Fix parser to support all operator symbols ([\#550](https://github.com/ruby/rbs/pull/550))
|
47
|
+
* Migrate from Minitest to Test::Unit ([\#556](https://github.com/ruby/rbs/pull/556))
|
48
|
+
* Fix type alias parsing ([\#565](https://github.com/ruby/rbs/pull/565))
|
49
|
+
* Support end-less method definition in `prototype rb` ([\#561](https://github.com/ruby/rbs/pull/561))
|
50
|
+
* Support method argument forwarding in `prototype rb` ([\#560](https://github.com/ruby/rbs/pull/560))
|
51
|
+
|
5
52
|
## 1.0.0 (2020-12-24)
|
6
53
|
|
7
54
|
* 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,11 @@ gemspec
|
|
5
5
|
|
6
6
|
# Development dependencies
|
7
7
|
gem "rake"
|
8
|
-
gem "
|
8
|
+
gem "test-unit"
|
9
9
|
gem "rspec"
|
10
10
|
gem "racc"
|
11
11
|
gem "rubocop"
|
12
12
|
gem "rubocop-rubycw"
|
13
|
-
gem "minitest-reporters"
|
14
13
|
gem "json"
|
15
14
|
gem "json-schema"
|
16
15
|
gem 'stackprof'
|
@@ -22,4 +21,9 @@ gem "rbs-amber", path: "test/assets/test-gem"
|
|
22
21
|
|
23
22
|
group :ide, optional: true do
|
24
23
|
gem "ruby-debug-ide"
|
24
|
+
gem "debase", ">= 0.2.5.beta2"
|
25
|
+
end
|
26
|
+
|
27
|
+
group :minitest do
|
28
|
+
gem "minitest"
|
25
29
|
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/array.rbs
CHANGED
@@ -1736,7 +1736,7 @@ class Array[unchecked out Elem] < Object
|
|
1736
1736
|
# See also Enumerable#sort_by.
|
1737
1737
|
#
|
1738
1738
|
def sort: () -> ::Array[Elem]
|
1739
|
-
| () { (Elem a, Elem b) -> ::Integer
|
1739
|
+
| () { (Elem a, Elem b) -> ::Integer } -> ::Array[Elem]
|
1740
1740
|
|
1741
1741
|
# Sorts `self` in place.
|
1742
1742
|
#
|
@@ -1757,7 +1757,7 @@ class Array[unchecked out Elem] < Object
|
|
1757
1757
|
# See also Enumerable#sort_by.
|
1758
1758
|
#
|
1759
1759
|
def sort!: () -> self
|
1760
|
-
| () { (Elem a, Elem b) -> ::Integer
|
1760
|
+
| () { (Elem a, Elem b) -> ::Integer } -> self
|
1761
1761
|
|
1762
1762
|
# Sorts `self` in place using a set of keys generated by mapping the values in
|
1763
1763
|
# `self` through the given block.
|
data/core/complex.rbs
CHANGED
data/core/encoding.rbs
CHANGED
data/core/enumerable.rbs
CHANGED
@@ -286,8 +286,22 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
|
|
286
286
|
def sort_by: () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
|
287
287
|
| () -> ::Enumerator[Elem, ::Array[Elem]]
|
288
288
|
|
289
|
-
|
289
|
+
# Returns first n elements from *enum*.
|
290
|
+
#
|
291
|
+
# a = [1, 2, 3, 4, 5, 0]
|
292
|
+
# a.take(3) #=> [1, 2, 3]
|
293
|
+
# a.take(30) #=> [1, 2, 3, 4, 5, 0]
|
294
|
+
#
|
295
|
+
def take: (Integer n) -> ::Array[Elem]
|
290
296
|
|
297
|
+
# Passes elements to the block until the block returns `nil` or `false`, then
|
298
|
+
# stops iterating and returns an array of all prior elements.
|
299
|
+
#
|
300
|
+
# If no block is given, an enumerator is returned instead.
|
301
|
+
#
|
302
|
+
# a = [1, 2, 3, 4, 5, 0]
|
303
|
+
# a.take_while { |i| i < 3 } #=> [1, 2]
|
304
|
+
#
|
291
305
|
def take_while: () { (Elem) -> boolish } -> ::Array[Elem]
|
292
306
|
| () -> ::Enumerator[Elem, ::Array[Elem]]
|
293
307
|
|
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.
|
@@ -984,7 +985,8 @@ class File::Stat < Object
|
|
984
985
|
include Comparable
|
985
986
|
|
986
987
|
def initialize: (String file) -> Object
|
987
|
-
def <=>: (File::Stat other) -> Integer
|
988
|
+
def <=>: (File::Stat other) -> Integer
|
989
|
+
| (untyped) -> nil
|
988
990
|
|
989
991
|
def atime: () -> Time
|
990
992
|
|
data/core/integer.rbs
CHANGED
@@ -112,7 +112,8 @@ class Integer < Numeric
|
|
112
112
|
#
|
113
113
|
# `nil` is returned if the two values are incomparable.
|
114
114
|
#
|
115
|
-
def <=>: (
|
115
|
+
def <=>: (Integer | Rational) -> Integer
|
116
|
+
| (untyped) -> Integer?
|
116
117
|
|
117
118
|
# Returns `true` if `int` equals `other` numerically. Contrast this with
|
118
119
|
# Integer#eql?, which requires `other` to be an Integer.
|
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
|