rbs 0.13.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +9 -5
- data/.gitignore +0 -1
- data/CHANGELOG.md +33 -1
- data/Gemfile +4 -0
- data/README.md +9 -3
- data/Rakefile +14 -1
- data/Steepfile +1 -1
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/bin/test_runner.rb +15 -1
- data/{stdlib/builtin → core}/array.rbs +124 -120
- data/{stdlib/builtin → core}/basic_object.rbs +54 -54
- data/{stdlib/builtin → core}/binding.rbs +42 -42
- data/core/builtin.rbs +70 -0
- data/{stdlib/builtin → core}/class.rbs +33 -33
- data/{stdlib/builtin → core}/comparable.rbs +0 -0
- data/{stdlib/builtin → core}/complex.rbs +90 -90
- data/{stdlib/builtin → core}/constants.rbs +0 -0
- data/{stdlib/builtin → core}/data.rbs +0 -0
- data/{stdlib/builtin → core}/deprecated.rbs +0 -0
- data/{stdlib/builtin → core}/dir.rbs +1 -1
- data/{stdlib/builtin → core}/encoding.rbs +33 -33
- data/{stdlib/builtin → core}/enumerable.rbs +99 -92
- data/{stdlib/builtin → core}/enumerator.rbs +40 -40
- data/{stdlib/builtin → core}/errno.rbs +0 -0
- data/{stdlib/builtin → core}/errors.rbs +2 -2
- data/{stdlib/builtin → core}/exception.rbs +50 -50
- data/{stdlib/builtin → core}/false_class.rbs +6 -6
- data/{stdlib/builtin → core}/fiber.rbs +14 -14
- data/{stdlib/builtin → core}/fiber_error.rbs +1 -1
- data/{stdlib/builtin → core}/file.rbs +0 -0
- data/{stdlib/builtin → core}/file_test.rbs +0 -0
- data/{stdlib/builtin → core}/float.rbs +161 -161
- data/{stdlib/builtin → core}/gc.rbs +3 -3
- data/{stdlib/builtin → core}/hash.rbs +15 -15
- data/{stdlib/builtin → core}/integer.rbs +0 -0
- data/{stdlib/builtin → core}/io.rbs +89 -89
- data/{stdlib/builtin → core}/kernel.rbs +70 -154
- data/{stdlib/builtin → core}/marshal.rbs +0 -0
- data/{stdlib/builtin → core}/match_data.rbs +1 -1
- data/{stdlib/builtin → core}/math.rbs +0 -0
- data/{stdlib/builtin → core}/method.rbs +19 -19
- data/{stdlib/builtin → core}/module.rbs +13 -13
- data/{stdlib/builtin → core}/nil_class.rbs +20 -20
- data/{stdlib/builtin → core}/numeric.rbs +101 -101
- data/{stdlib/builtin → core}/object.rbs +173 -173
- data/{stdlib/builtin → core}/proc.rbs +91 -91
- data/{stdlib/builtin → core}/process.rbs +0 -0
- data/{stdlib/builtin → core}/random.rbs +1 -1
- data/{stdlib/builtin → core}/range.rbs +4 -6
- data/{stdlib/builtin → core}/rational.rbs +83 -83
- data/{stdlib/builtin → core}/rb_config.rbs +0 -0
- data/{stdlib/builtin → core}/regexp.rbs +0 -0
- data/{stdlib/builtin → core}/ruby_vm.rbs +0 -0
- data/{stdlib/builtin → core}/signal.rbs +7 -7
- data/{stdlib/builtin → core}/string.rbs +10 -10
- data/{stdlib/builtin → core}/string_io.rbs +8 -8
- data/{stdlib/builtin → core}/struct.rbs +2 -2
- data/{stdlib/builtin → core}/symbol.rbs +1 -1
- data/{stdlib/builtin → core}/thread.rbs +189 -189
- data/{stdlib/builtin → core}/thread_group.rbs +2 -2
- data/{stdlib/builtin → core}/time.rbs +0 -0
- data/{stdlib/builtin → core}/trace_point.rbs +0 -0
- data/{stdlib/builtin → core}/true_class.rbs +10 -10
- data/{stdlib/builtin → core}/unbound_method.rbs +0 -0
- data/{stdlib/builtin → core}/warning.rbs +1 -1
- data/docs/CONTRIBUTING.md +1 -0
- data/docs/repo.md +125 -0
- data/docs/syntax.md +50 -6
- data/goodcheck.yml +22 -5
- data/lib/rbs.rb +1 -0
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/cli.rb +105 -103
- data/lib/rbs/definition.rb +9 -4
- data/lib/rbs/definition_builder.rb +54 -22
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/environment_loader.rb +79 -105
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3153 -0
- data/lib/rbs/parser.y +25 -11
- data/lib/rbs/prototype/rb.rb +47 -9
- data/lib/rbs/prototype/runtime.rb +17 -7
- data/lib/rbs/repository.rb +121 -0
- data/lib/rbs/test/hook.rb +2 -0
- data/lib/rbs/test/setup.rb +5 -3
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/tester.rb +4 -1
- data/lib/rbs/test/type_check.rb +12 -6
- data/lib/rbs/type_name.rb +3 -2
- data/lib/rbs/variance_calculator.rb +1 -1
- data/lib/rbs/vendorer.rb +38 -16
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +1 -1
- data/sig/cli.rbs +58 -0
- data/sig/constant.rbs +2 -2
- data/sig/constant_table.rbs +11 -11
- data/sig/declarations.rbs +2 -2
- data/sig/definition.rbs +10 -5
- data/sig/definition_builder.rbs +4 -1
- data/sig/environment_loader.rbs +92 -46
- data/sig/members.rbs +2 -2
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +4 -4
- data/sig/parser.rbs +25 -0
- data/sig/polyfill.rbs +42 -0
- data/sig/rbs.rbs +8 -0
- data/sig/repository.rbs +79 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/vendorer.rbs +44 -0
- data/sig/writer.rbs +15 -15
- data/stdlib/abbrev/{abbrev.rbs → 0/abbrev.rbs} +0 -0
- data/stdlib/base64/{base64.rbs → 0/base64.rbs} +1 -1
- data/stdlib/benchmark/{benchmark.rbs → 0/benchmark.rbs} +2 -2
- data/stdlib/{bigdecimal/math → bigdecimal-math/0}/big_math.rbs +0 -0
- data/stdlib/bigdecimal/{big_decimal.rbs → 0/big_decimal.rbs} +0 -0
- data/stdlib/coverage/{coverage.rbs → 0/coverage.rbs} +2 -2
- data/stdlib/csv/{csv.rbs → 0/csv.rbs} +4 -4
- data/stdlib/date/{date.rbs → 0/date.rbs} +4 -4
- data/stdlib/date/{date_time.rbs → 0/date_time.rbs} +1 -1
- data/stdlib/dbm/0/dbm.rbs +277 -0
- data/stdlib/erb/{erb.rbs → 0/erb.rbs} +0 -0
- data/stdlib/fiber/{fiber.rbs → 0/fiber.rbs} +0 -0
- data/stdlib/find/{find.rbs → 0/find.rbs} +12 -12
- data/stdlib/forwardable/{forwardable.rbs → 0/forwardable.rbs} +0 -0
- data/stdlib/ipaddr/{ipaddr.rbs → 0/ipaddr.rbs} +0 -0
- data/stdlib/json/{json.rbs → 0/json.rbs} +0 -0
- data/stdlib/logger/{formatter.rbs → 0/formatter.rbs} +0 -0
- data/stdlib/logger/{log_device.rbs → 0/log_device.rbs} +1 -1
- data/stdlib/logger/{logger.rbs → 0/logger.rbs} +1 -1
- data/stdlib/logger/{period.rbs → 0/period.rbs} +0 -0
- data/stdlib/logger/{severity.rbs → 0/severity.rbs} +0 -0
- data/stdlib/mutex_m/{mutex_m.rbs → 0/mutex_m.rbs} +0 -0
- data/stdlib/pathname/{pathname.rbs → 0/pathname.rbs} +40 -40
- data/stdlib/prime/{integer-extension.rbs → 0/integer-extension.rbs} +0 -0
- data/stdlib/prime/{prime.rbs → 0/prime.rbs} +1 -1
- data/stdlib/pstore/0/pstore.rbs +287 -0
- data/stdlib/pty/{pty.rbs → 0/pty.rbs} +1 -1
- data/stdlib/securerandom/{securerandom.rbs → 0/securerandom.rbs} +0 -0
- data/stdlib/set/{set.rbs → 0/set.rbs} +10 -10
- data/stdlib/tmpdir/{tmpdir.rbs → 0/tmpdir.rbs} +12 -12
- data/stdlib/tsort/0/cyclic.rbs +4 -0
- data/stdlib/tsort/0/interfaces.rbs +19 -0
- data/stdlib/tsort/0/tsort.rbs +363 -0
- data/stdlib/uri/{file.rbs → 0/file.rbs} +0 -0
- data/stdlib/uri/{generic.rbs → 0/generic.rbs} +1 -1
- data/stdlib/uri/{http.rbs → 0/http.rbs} +0 -0
- data/stdlib/uri/{https.rbs → 0/https.rbs} +0 -0
- data/stdlib/uri/{ldap.rbs → 0/ldap.rbs} +0 -0
- data/stdlib/uri/{ldaps.rbs → 0/ldaps.rbs} +0 -0
- data/stdlib/zlib/{zlib.rbs → 0/zlib.rbs} +0 -0
- data/steep/Gemfile.lock +9 -9
- metadata +104 -93
- data/stdlib/builtin/builtin.rbs +0 -42
@@ -1,59 +1,59 @@
|
|
1
1
|
# A class which allows both internal and external iteration.
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# An [Enumerator](Enumerator) can be created by the
|
4
4
|
# following methods.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# - Kernel\#to\_enum
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# - Kernel\#enum\_for
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# - [::new](Enumerator#method-c-new)
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Most methods have two forms: a block form where the contents are
|
13
13
|
# evaluated for each item in the enumeration, and a non-block form which
|
14
14
|
# returns a new [Enumerator](Enumerator) wrapping the
|
15
15
|
# iteration.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# ```ruby
|
18
18
|
# enumerator = %w(one two three).each
|
19
19
|
# puts enumerator.class # => Enumerator
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# enumerator.each_with_object("foo") do |item, obj|
|
22
22
|
# puts "#{obj}: #{item}"
|
23
23
|
# end
|
24
|
-
#
|
24
|
+
#
|
25
25
|
# # foo: one
|
26
26
|
# # foo: two
|
27
27
|
# # foo: three
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# enum_with_obj = enumerator.each_with_object("foo")
|
30
30
|
# puts enum_with_obj.class # => Enumerator
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# enum_with_obj.each do |item, obj|
|
33
33
|
# puts "#{obj}: #{item}"
|
34
34
|
# end
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# # foo: one
|
37
37
|
# # foo: two
|
38
38
|
# # foo: three
|
39
39
|
# ```
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# This allows you to chain Enumerators together. For example, you can map
|
42
42
|
# a list's elements to strings containing the index and the element as a
|
43
43
|
# string via:
|
44
|
-
#
|
44
|
+
#
|
45
45
|
# ```ruby
|
46
46
|
# puts %w[foo bar baz].map.with_index { |w, i| "#{i}:#{w}" }
|
47
47
|
# # => ["0:foo", "1:bar", "2:baz"]
|
48
48
|
# ```
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# An [Enumerator](Enumerator) can also be used as an
|
51
51
|
# external iterator. For example,
|
52
52
|
# [\#next](Enumerator#method-i-next) returns the next
|
53
53
|
# value of the iterator or raises
|
54
54
|
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html) if
|
55
55
|
# the [Enumerator](Enumerator) is at the end.
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# ```ruby
|
58
58
|
# e = [1,2,3].each # returns an enumerator object.
|
59
59
|
# puts e.next # => 1
|
@@ -61,9 +61,9 @@
|
|
61
61
|
# puts e.next # => 3
|
62
62
|
# puts e.next # raises StopIteration
|
63
63
|
# ```
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# You can use this to implement an internal iterator as follows:
|
66
|
-
#
|
66
|
+
#
|
67
67
|
# ```ruby
|
68
68
|
# def ext_each(e)
|
69
69
|
# while true
|
@@ -76,27 +76,27 @@
|
|
76
76
|
# e.feed y
|
77
77
|
# end
|
78
78
|
# end
|
79
|
-
#
|
79
|
+
#
|
80
80
|
# o = Object.new
|
81
|
-
#
|
81
|
+
#
|
82
82
|
# def o.each
|
83
83
|
# puts yield
|
84
84
|
# puts yield(1)
|
85
85
|
# puts yield(1, 2)
|
86
86
|
# 3
|
87
87
|
# end
|
88
|
-
#
|
88
|
+
#
|
89
89
|
# # use o.each as an internal iterator directly.
|
90
90
|
# puts o.each {|*x| puts x; [:b, *x] }
|
91
91
|
# # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3
|
92
|
-
#
|
92
|
+
#
|
93
93
|
# # convert o.each to an external iterator for
|
94
94
|
# # implementing an internal iterator.
|
95
95
|
# puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] }
|
96
96
|
# # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3
|
97
97
|
# ```
|
98
98
|
class Enumerator[unchecked out Elem, out Return] < Object
|
99
|
-
include Enumerable[Elem
|
99
|
+
include Enumerable[Elem]
|
100
100
|
|
101
101
|
def each: () { (Elem arg0) -> untyped } -> Return
|
102
102
|
| () -> self
|
@@ -112,8 +112,8 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
112
112
|
# position forward. When the position reached at the end,
|
113
113
|
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html) is
|
114
114
|
# raised.
|
115
|
-
#
|
116
|
-
#
|
115
|
+
#
|
116
|
+
#
|
117
117
|
# ```ruby
|
118
118
|
# a = [1,2,3]
|
119
119
|
# e = a.to_enum
|
@@ -122,7 +122,7 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
122
122
|
# p e.next #=> 3
|
123
123
|
# p e.next #raises StopIteration
|
124
124
|
# ```
|
125
|
-
#
|
125
|
+
#
|
126
126
|
# Note that enumeration sequence by `next` does not affect other
|
127
127
|
# non-external enumeration methods, unless the underlying iteration
|
128
128
|
# methods itself has side-effect, e.g.
|
@@ -134,10 +134,10 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
134
134
|
# internal position forward. When the position reached at the end,
|
135
135
|
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html) is
|
136
136
|
# raised.
|
137
|
-
#
|
137
|
+
#
|
138
138
|
# This method can be used to distinguish `yield` and `yield nil` .
|
139
|
-
#
|
140
|
-
#
|
139
|
+
#
|
140
|
+
#
|
141
141
|
# ```ruby
|
142
142
|
# o = Object.new
|
143
143
|
# def o.each
|
@@ -159,7 +159,7 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
159
159
|
# p e.next
|
160
160
|
# p e.next
|
161
161
|
# p e.next
|
162
|
-
#
|
162
|
+
#
|
163
163
|
# ## yield args next_values next
|
164
164
|
# # yield [] nil
|
165
165
|
# # yield 1 [1] 1
|
@@ -167,7 +167,7 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
167
167
|
# # yield nil [nil] nil
|
168
168
|
# # yield [1, 2] [[1, 2]] [1, 2]
|
169
169
|
# ```
|
170
|
-
#
|
170
|
+
#
|
171
171
|
# Note that `next_values` does not affect other non-external enumeration
|
172
172
|
# methods unless underlying iteration method itself has side-effect, e.g.
|
173
173
|
# [IO\#each\_line](https://ruby-doc.org/core-2.6.3/IO.html#method-i-each_line)
|
@@ -178,8 +178,8 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
178
178
|
# position forward. If the position is already at the end,
|
179
179
|
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html) is
|
180
180
|
# raised.
|
181
|
-
#
|
182
|
-
#
|
181
|
+
#
|
182
|
+
#
|
183
183
|
# ```ruby
|
184
184
|
# a = [1,2,3]
|
185
185
|
# e = a.to_enum
|
@@ -199,8 +199,8 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
199
199
|
# already at the end,
|
200
200
|
# [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html) is
|
201
201
|
# raised.
|
202
|
-
#
|
203
|
-
#
|
202
|
+
#
|
203
|
+
#
|
204
204
|
# ```ruby
|
205
205
|
# o = Object.new
|
206
206
|
# def o.each
|
@@ -221,13 +221,13 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
221
221
|
def peek_values: () -> ::Array[Elem]
|
222
222
|
|
223
223
|
# Rewinds the enumeration sequence to the beginning.
|
224
|
-
#
|
224
|
+
#
|
225
225
|
# If the enclosed object responds to a “rewind” method, it is called.
|
226
226
|
def rewind: () -> self
|
227
227
|
|
228
228
|
# Returns the size of the enumerator, or `nil` if it can’t be calculated
|
229
229
|
# lazily.
|
230
|
-
#
|
230
|
+
#
|
231
231
|
# ```ruby
|
232
232
|
# (1..100).to_a.permutation(4).size # => 94109400
|
233
233
|
# loop.size # => Float::INFINITY
|
@@ -242,8 +242,8 @@ class Enumerator[unchecked out Elem, out Return] < Object
|
|
242
242
|
| [U] (U arg0) -> ::Enumerator[[ Elem, U ], Return]
|
243
243
|
end
|
244
244
|
|
245
|
-
class Enumerator::Generator[out Elem
|
246
|
-
include Enumerable[Elem
|
245
|
+
class Enumerator::Generator[out Elem] < Object
|
246
|
+
include Enumerable[Elem]
|
247
247
|
end
|
248
248
|
|
249
249
|
class Enumerator::Lazy[out Elem, out Return] < Enumerator[Elem, Return]
|
@@ -257,6 +257,6 @@ class Enumerator::Yielder < Object
|
|
257
257
|
def to_proc: () -> Proc
|
258
258
|
end
|
259
259
|
|
260
|
-
class Enumerator::Chain[out Elem
|
261
|
-
include Enumerable[Elem
|
260
|
+
class Enumerator::Chain[out Elem] < Object
|
261
|
+
include Enumerable[Elem]
|
262
262
|
end
|
File without changes
|
@@ -20,7 +20,7 @@
|
|
20
20
|
class ArgumentError < StandardError
|
21
21
|
end
|
22
22
|
|
23
|
-
# The exception class which will be raised when pushing into a closed Queue.
|
23
|
+
# The exception class which will be raised when pushing into a closed Queue.
|
24
24
|
# See Queue#close and SizedQueue#close.
|
25
25
|
#
|
26
26
|
class ClosedQueueError < StopIteration
|
@@ -266,7 +266,7 @@ class NoMethodError[T] < NameError[T]
|
|
266
266
|
#
|
267
267
|
# *receiver* argument stores an object whose method was called.
|
268
268
|
#
|
269
|
-
def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?
|
269
|
+
def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?boolish `private`, ?receiver: T?) -> void
|
270
270
|
|
271
271
|
public
|
272
272
|
|
@@ -9,19 +9,19 @@
|
|
9
9
|
# information like
|
10
10
|
# [NameError\#name](https://ruby-doc.org/core-2.6.3/NameError.html#method-i-name)
|
11
11
|
# .
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# Programs may make subclasses of
|
14
14
|
# [Exception](Exception), typically of
|
15
15
|
# [StandardError](https://ruby-doc.org/core-2.6.3/StandardError.html) or
|
16
16
|
# [RuntimeError](https://ruby-doc.org/core-2.6.3/RuntimeError.html), to
|
17
17
|
# provide custom classes and add additional information. See the subclass
|
18
18
|
# list below for defaults for `raise` and `rescue` .
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# When an exception has been raised but not yet handled (in `rescue`,
|
21
21
|
# `ensure`, `at_exit` and `END` blocks) the global variable `$!` will
|
22
22
|
# contain the current exception and `$@` contains the current exception’s
|
23
23
|
# backtrace.
|
24
|
-
#
|
24
|
+
#
|
25
25
|
# It is recommended that a library should have one subclass of
|
26
26
|
# [StandardError](https://ruby-doc.org/core-2.6.3/StandardError.html) or
|
27
27
|
# [RuntimeError](https://ruby-doc.org/core-2.6.3/RuntimeError.html) and
|
@@ -29,97 +29,97 @@
|
|
29
29
|
# rescue a generic exception type to catch all exceptions the library may
|
30
30
|
# raise even if future versions of the library add new exception
|
31
31
|
# subclasses.
|
32
|
-
#
|
32
|
+
#
|
33
33
|
# For example:
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# ```ruby
|
36
36
|
# class MyLibrary
|
37
37
|
# class Error < RuntimeError
|
38
38
|
# end
|
39
|
-
#
|
39
|
+
#
|
40
40
|
# class WidgetError < Error
|
41
41
|
# end
|
42
|
-
#
|
42
|
+
#
|
43
43
|
# class FrobError < Error
|
44
44
|
# end
|
45
|
-
#
|
45
|
+
#
|
46
46
|
# end
|
47
47
|
# ```
|
48
|
-
#
|
48
|
+
#
|
49
49
|
# To handle both WidgetError and FrobError the library user can rescue
|
50
50
|
# MyLibrary::Error.
|
51
|
-
#
|
51
|
+
#
|
52
52
|
# The built-in subclasses of [Exception](Exception)
|
53
53
|
# are:
|
54
|
-
#
|
54
|
+
#
|
55
55
|
# - [NoMemoryError](https://ruby-doc.org/core-2.6.3/NoMemoryError.html)
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# - [ScriptError](https://ruby-doc.org/core-2.6.3/ScriptError.html)
|
58
|
-
#
|
58
|
+
#
|
59
59
|
# - [LoadError](https://ruby-doc.org/core-2.6.3/LoadError.html)
|
60
|
-
#
|
60
|
+
#
|
61
61
|
# - [NotImplementedError](https://ruby-doc.org/core-2.6.3/NotImplementedError.html)
|
62
|
-
#
|
62
|
+
#
|
63
63
|
# - [SyntaxError](https://ruby-doc.org/core-2.6.3/SyntaxError.html)
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# - [SecurityError](https://ruby-doc.org/core-2.6.3/SecurityError.html)
|
66
|
-
#
|
66
|
+
#
|
67
67
|
# - [SignalException](https://ruby-doc.org/core-2.6.3/SignalException.html)
|
68
|
-
#
|
68
|
+
#
|
69
69
|
# - [Interrupt](https://ruby-doc.org/core-2.6.3/Interrupt.html)
|
70
|
-
#
|
70
|
+
#
|
71
71
|
# - [StandardError](https://ruby-doc.org/core-2.6.3/StandardError.html)
|
72
72
|
# -- default for `rescue`
|
73
|
-
#
|
73
|
+
#
|
74
74
|
# - [ArgumentError](https://ruby-doc.org/core-2.6.3/ArgumentError.html)
|
75
|
-
#
|
75
|
+
#
|
76
76
|
# - [UncaughtThrowError](https://ruby-doc.org/core-2.6.3/UncaughtThrowError.html)
|
77
|
-
#
|
77
|
+
#
|
78
78
|
# - [EncodingError](https://ruby-doc.org/core-2.6.3/EncodingError.html)
|
79
|
-
#
|
79
|
+
#
|
80
80
|
# - [FiberError](https://ruby-doc.org/core-2.6.3/FiberError.html)
|
81
|
-
#
|
81
|
+
#
|
82
82
|
# - [IOError](https://ruby-doc.org/core-2.6.3/IOError.html)
|
83
|
-
#
|
83
|
+
#
|
84
84
|
# - [EOFError](https://ruby-doc.org/core-2.6.3/EOFError.html)
|
85
|
-
#
|
85
|
+
#
|
86
86
|
# - [IndexError](https://ruby-doc.org/core-2.6.3/IndexError.html)
|
87
|
-
#
|
87
|
+
#
|
88
88
|
# - [KeyError](https://ruby-doc.org/core-2.6.3/KeyError.html)
|
89
|
-
#
|
89
|
+
#
|
90
90
|
# - [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html)
|
91
|
-
#
|
91
|
+
#
|
92
92
|
# - [LocalJumpError](https://ruby-doc.org/core-2.6.3/LocalJumpError.html)
|
93
|
-
#
|
93
|
+
#
|
94
94
|
# - [NameError](https://ruby-doc.org/core-2.6.3/NameError.html)
|
95
|
-
#
|
95
|
+
#
|
96
96
|
# - [NoMethodError](https://ruby-doc.org/core-2.6.3/NoMethodError.html)
|
97
|
-
#
|
97
|
+
#
|
98
98
|
# - [RangeError](https://ruby-doc.org/core-2.6.3/RangeError.html)
|
99
|
-
#
|
99
|
+
#
|
100
100
|
# - [FloatDomainError](https://ruby-doc.org/core-2.6.3/FloatDomainError.html)
|
101
|
-
#
|
101
|
+
#
|
102
102
|
# - [RegexpError](https://ruby-doc.org/core-2.6.3/RegexpError.html)
|
103
|
-
#
|
103
|
+
#
|
104
104
|
# - [RuntimeError](https://ruby-doc.org/core-2.6.3/RuntimeError.html)
|
105
105
|
# -- default for `raise`
|
106
|
-
#
|
106
|
+
#
|
107
107
|
# - [FrozenError](https://ruby-doc.org/core-2.6.3/FrozenError.html)
|
108
|
-
#
|
108
|
+
#
|
109
109
|
# - [SystemCallError](https://ruby-doc.org/core-2.6.3/SystemCallError.html)
|
110
|
-
#
|
110
|
+
#
|
111
111
|
# - Errno::\*
|
112
|
-
#
|
112
|
+
#
|
113
113
|
# - [ThreadError](https://ruby-doc.org/core-2.6.3/ThreadError.html)
|
114
|
-
#
|
114
|
+
#
|
115
115
|
# - [TypeError](https://ruby-doc.org/core-2.6.3/TypeError.html)
|
116
|
-
#
|
116
|
+
#
|
117
117
|
# - [ZeroDivisionError](https://ruby-doc.org/core-2.6.3/ZeroDivisionError.html)
|
118
|
-
#
|
118
|
+
#
|
119
119
|
# - [SystemExit](https://ruby-doc.org/core-2.6.3/SystemExit.html)
|
120
|
-
#
|
120
|
+
#
|
121
121
|
# - [SystemStackError](https://ruby-doc.org/core-2.6.3/SystemStackError.html)
|
122
|
-
#
|
122
|
+
#
|
123
123
|
# - fatal – impossible to rescue
|
124
124
|
class Exception < Object
|
125
125
|
def self.to_tty?: () -> bool
|
@@ -131,25 +131,25 @@ class Exception < Object
|
|
131
131
|
# Returns any backtrace associated with the exception. The backtrace is an
|
132
132
|
# array of strings, each containing either “filename:lineNo: in \`method”‘
|
133
133
|
# or “filename:lineNo.”
|
134
|
-
#
|
134
|
+
#
|
135
135
|
# ```ruby
|
136
136
|
# def a
|
137
137
|
# raise "boom"
|
138
138
|
# end
|
139
|
-
#
|
139
|
+
#
|
140
140
|
# def b
|
141
141
|
# a()
|
142
142
|
# end
|
143
|
-
#
|
143
|
+
#
|
144
144
|
# begin
|
145
145
|
# b()
|
146
146
|
# rescue => detail
|
147
147
|
# print detail.backtrace.join("\n")
|
148
148
|
# end
|
149
149
|
# ```
|
150
|
-
#
|
150
|
+
#
|
151
151
|
# *produces:*
|
152
|
-
#
|
152
|
+
#
|
153
153
|
# prog.rb:2:in `a'
|
154
154
|
# prog.rb:6:in `b'
|
155
155
|
# prog.rb:10
|
@@ -161,7 +161,7 @@ class Exception < Object
|
|
161
161
|
# the backtrace is an array of
|
162
162
|
# [Thread::Backtrace::Location](https://ruby-doc.org/core-2.6.3/Thread/Backtrace/Location.html)
|
163
163
|
# .
|
164
|
-
#
|
164
|
+
#
|
165
165
|
# Now, this method is not affected by
|
166
166
|
# [\#set\_backtrace](Exception.downloaded.ruby_doc#method-i-set_backtrace)
|
167
167
|
# .
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# The global value `false` is the only instance of class FalseClass and
|
2
2
|
# represents a logically false value in boolean expressions. The class provides
|
3
3
|
# operators allowing `false` to participate correctly in logical expressions.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
class FalseClass
|
6
6
|
public
|
7
7
|
|
@@ -9,19 +9,19 @@ class FalseClass
|
|
9
9
|
|
10
10
|
# And---Returns `false`. *obj* is always evaluated as it is the argument to a
|
11
11
|
# method call---there is no short-circuit evaluation in this case.
|
12
|
-
#
|
12
|
+
#
|
13
13
|
def &: (untyped obj) -> bool
|
14
14
|
|
15
15
|
# Case Equality -- For class Object, effectively the same as calling `#==`, but
|
16
16
|
# typically overridden by descendants to provide meaningful semantics in `case`
|
17
17
|
# statements.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
def ===: (false) -> true
|
20
20
|
| (untyped obj) -> bool
|
21
21
|
|
22
22
|
# Exclusive Or---If *obj* is `nil` or `false`, returns `false`; otherwise,
|
23
23
|
# returns `true`.
|
24
|
-
#
|
24
|
+
#
|
25
25
|
def ^: (nil) -> false
|
26
26
|
| (false) -> false
|
27
27
|
| (untyped obj) -> bool
|
@@ -29,11 +29,11 @@ class FalseClass
|
|
29
29
|
alias inspect to_s
|
30
30
|
|
31
31
|
# The string representation of `false` is "false".
|
32
|
-
#
|
32
|
+
#
|
33
33
|
def to_s: () -> "false"
|
34
34
|
|
35
35
|
# Or---Returns `false` if *obj* is `nil` or `false`; `true` otherwise.
|
36
|
-
#
|
36
|
+
#
|
37
37
|
def |: (nil) -> false
|
38
38
|
| (false) -> false
|
39
39
|
| (untyped obj) -> bool
|