rbs 2.0.0 → 2.2.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.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +34 -0
  3. data/.github/workflows/ruby.yml +5 -0
  4. data/CHANGELOG.md +82 -0
  5. data/README.md +6 -1
  6. data/Rakefile +56 -21
  7. data/core/array.rbs +2866 -1086
  8. data/core/basic_object.rbs +150 -30
  9. data/core/binding.rbs +33 -0
  10. data/core/builtin.rbs +4 -4
  11. data/core/class.rbs +43 -5
  12. data/core/comparable.rbs +57 -0
  13. data/core/complex.rbs +170 -4
  14. data/core/constants.rbs +51 -0
  15. data/core/deprecated.rbs +7 -0
  16. data/core/dir.rbs +305 -20
  17. data/core/encoding.rbs +1214 -77
  18. data/core/enumerable.rbs +2173 -234
  19. data/core/enumerator.rbs +448 -182
  20. data/core/env.rbs +448 -1
  21. data/core/errno.rbs +1 -10
  22. data/core/errors.rbs +152 -2
  23. data/core/exception.rbs +201 -127
  24. data/core/false_class.rbs +27 -0
  25. data/core/fiber.rbs +118 -37
  26. data/core/fiber_error.rbs +8 -9
  27. data/core/file.rbs +1060 -142
  28. data/core/file_test.rbs +287 -32
  29. data/core/float.rbs +776 -300
  30. data/core/gc.rbs +185 -34
  31. data/core/global_variables.rbs +5 -1
  32. data/core/hash.rbs +1582 -649
  33. data/core/integer.rbs +974 -204
  34. data/core/io/buffer.rbs +710 -0
  35. data/core/io/wait.rbs +29 -8
  36. data/core/io.rbs +2438 -417
  37. data/core/kernel.rbs +2319 -318
  38. data/core/marshal.rbs +37 -2
  39. data/core/match_data.rbs +123 -6
  40. data/core/math.rbs +126 -6
  41. data/core/method.rbs +226 -102
  42. data/core/module.rbs +421 -45
  43. data/core/nil_class.rbs +64 -0
  44. data/core/numeric.rbs +620 -142
  45. data/core/object.rbs +453 -81
  46. data/core/object_space.rbs +92 -2
  47. data/core/proc.rbs +482 -285
  48. data/core/process.rbs +443 -34
  49. data/core/ractor.rbs +232 -9
  50. data/core/random.rbs +151 -52
  51. data/core/range.rbs +885 -160
  52. data/core/rational.rbs +122 -6
  53. data/core/rb_config.rbs +14 -4
  54. data/core/refinement.rbs +44 -0
  55. data/core/regexp.rbs +156 -14
  56. data/core/ruby_vm.rbs +42 -3
  57. data/core/signal.rbs +78 -39
  58. data/core/string.rbs +2123 -567
  59. data/core/string_io.rbs +204 -0
  60. data/core/struct.rbs +283 -28
  61. data/core/symbol.rbs +304 -30
  62. data/core/thread.rbs +1288 -688
  63. data/core/thread_group.rbs +66 -10
  64. data/core/time.rbs +643 -217
  65. data/core/trace_point.rbs +100 -12
  66. data/core/true_class.rbs +24 -0
  67. data/core/unbound_method.rbs +73 -7
  68. data/core/warning.rbs +37 -12
  69. data/docs/CONTRIBUTING.md +40 -34
  70. data/docs/stdlib.md +3 -102
  71. data/docs/syntax.md +54 -11
  72. data/ext/rbs_extension/extconf.rb +1 -0
  73. data/ext/rbs_extension/lexer.h +5 -0
  74. data/ext/rbs_extension/lexstate.c +6 -0
  75. data/ext/rbs_extension/parser.c +85 -10
  76. data/ext/rbs_extension/ruby_objs.c +4 -2
  77. data/ext/rbs_extension/ruby_objs.h +2 -2
  78. data/goodcheck.yml +0 -11
  79. data/lib/rbs/annotate/annotations.rb +197 -0
  80. data/lib/rbs/annotate/formatter.rb +80 -0
  81. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  82. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  83. data/lib/rbs/annotate.rb +6 -0
  84. data/lib/rbs/ast/members.rb +21 -13
  85. data/lib/rbs/buffer.rb +17 -11
  86. data/lib/rbs/cli.rb +48 -1
  87. data/lib/rbs/definition_builder/method_builder.rb +28 -16
  88. data/lib/rbs/definition_builder.rb +6 -2
  89. data/lib/rbs/environment.rb +8 -4
  90. data/lib/rbs/location_aux.rb +12 -0
  91. data/lib/rbs/namespace.rb +1 -1
  92. data/lib/rbs/prototype/rb.rb +12 -0
  93. data/lib/rbs/type_alias_regularity.rb +6 -4
  94. data/lib/rbs/type_name.rb +1 -1
  95. data/lib/rbs/types.rb +1 -1
  96. data/lib/rbs/validator.rb +6 -0
  97. data/lib/rbs/version.rb +1 -1
  98. data/lib/rbs/writer.rb +54 -4
  99. data/lib/rbs.rb +0 -2
  100. data/schema/typeParam.json +3 -3
  101. data/sig/annotate/annotations.rbs +102 -0
  102. data/sig/annotate/formatter.rbs +24 -0
  103. data/sig/annotate/rdoc_annotater.rbs +82 -0
  104. data/sig/annotate/rdoc_source.rbs +30 -0
  105. data/sig/buffer.rbs +6 -2
  106. data/sig/cli.rbs +2 -0
  107. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  108. data/sig/location.rbs +6 -0
  109. data/sig/members.rbs +24 -18
  110. data/sig/method_builder.rbs +5 -4
  111. data/sig/method_types.rbs +5 -1
  112. data/sig/polyfill.rbs +78 -0
  113. data/sig/validator.rbs +3 -1
  114. data/sig/writer.rbs +79 -2
  115. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  116. data/stdlib/abbrev/0/array.rbs +26 -0
  117. data/stdlib/base64/0/base64.rbs +31 -0
  118. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  119. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  120. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  121. data/stdlib/cgi/0/core.rbs +649 -21
  122. data/stdlib/coverage/0/coverage.rbs +164 -2
  123. data/stdlib/csv/0/csv.rbs +2862 -398
  124. data/stdlib/date/0/date.rbs +483 -25
  125. data/stdlib/date/0/date_time.rbs +187 -12
  126. data/stdlib/dbm/0/dbm.rbs +152 -17
  127. data/stdlib/digest/0/digest.rbs +146 -0
  128. data/stdlib/erb/0/erb.rbs +65 -245
  129. data/stdlib/fiber/0/fiber.rbs +73 -91
  130. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  131. data/stdlib/find/0/find.rbs +9 -0
  132. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  133. data/stdlib/io-console/0/io-console.rbs +227 -15
  134. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  135. data/stdlib/json/0/json.rbs +1147 -145
  136. data/stdlib/logger/0/formatter.rbs +24 -0
  137. data/stdlib/logger/0/log_device.rbs +64 -0
  138. data/stdlib/logger/0/logger.rbs +165 -13
  139. data/stdlib/logger/0/period.rbs +10 -0
  140. data/stdlib/logger/0/severity.rbs +26 -0
  141. data/stdlib/monitor/0/monitor.rbs +163 -0
  142. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  143. data/stdlib/net-http/0/manifest.yaml +1 -0
  144. data/stdlib/net-http/0/net-http.rbs +1513 -683
  145. data/stdlib/nkf/0/nkf.rbs +372 -0
  146. data/stdlib/objspace/0/objspace.rbs +149 -90
  147. data/stdlib/openssl/0/openssl.rbs +8108 -71
  148. data/stdlib/optparse/0/optparse.rbs +487 -19
  149. data/stdlib/pathname/0/pathname.rbs +425 -124
  150. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  151. data/stdlib/prime/0/integer-extension.rbs +20 -2
  152. data/stdlib/prime/0/prime.rbs +88 -21
  153. data/stdlib/pstore/0/pstore.rbs +102 -0
  154. data/stdlib/pty/0/pty.rbs +64 -14
  155. data/stdlib/resolv/0/resolv.rbs +420 -31
  156. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  157. data/stdlib/rubygems/0/config_file.rbs +33 -1
  158. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  159. data/stdlib/rubygems/0/installer.rbs +13 -1
  160. data/stdlib/rubygems/0/path_support.rbs +4 -1
  161. data/stdlib/rubygems/0/platform.rbs +5 -1
  162. data/stdlib/rubygems/0/request_set.rbs +44 -2
  163. data/stdlib/rubygems/0/requirement.rbs +65 -2
  164. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  165. data/stdlib/rubygems/0/source_list.rbs +13 -0
  166. data/stdlib/rubygems/0/specification.rbs +21 -1
  167. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  168. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  169. data/stdlib/rubygems/0/version.rbs +60 -157
  170. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  171. data/stdlib/set/0/set.rbs +423 -109
  172. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  173. data/stdlib/singleton/0/singleton.rbs +20 -0
  174. data/stdlib/socket/0/addrinfo.rbs +210 -9
  175. data/stdlib/socket/0/basic_socket.rbs +103 -11
  176. data/stdlib/socket/0/ip_socket.rbs +31 -9
  177. data/stdlib/socket/0/socket.rbs +586 -38
  178. data/stdlib/socket/0/tcp_server.rbs +22 -2
  179. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  180. data/stdlib/socket/0/udp_socket.rbs +25 -2
  181. data/stdlib/socket/0/unix_server.rbs +22 -2
  182. data/stdlib/socket/0/unix_socket.rbs +45 -5
  183. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  184. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  185. data/stdlib/time/0/time.rbs +208 -116
  186. data/stdlib/timeout/0/timeout.rbs +10 -0
  187. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  188. data/stdlib/tsort/0/cyclic.rbs +1 -0
  189. data/stdlib/tsort/0/interfaces.rbs +1 -0
  190. data/stdlib/tsort/0/tsort.rbs +42 -0
  191. data/stdlib/uri/0/common.rbs +57 -8
  192. data/stdlib/uri/0/file.rbs +55 -109
  193. data/stdlib/uri/0/ftp.rbs +6 -3
  194. data/stdlib/uri/0/generic.rbs +558 -329
  195. data/stdlib/uri/0/http.rbs +60 -114
  196. data/stdlib/uri/0/https.rbs +8 -102
  197. data/stdlib/uri/0/ldap.rbs +143 -137
  198. data/stdlib/uri/0/ldaps.rbs +8 -102
  199. data/stdlib/uri/0/mailto.rbs +3 -0
  200. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  201. data/stdlib/uri/0/ws.rbs +6 -3
  202. data/stdlib/uri/0/wss.rbs +5 -3
  203. data/stdlib/yaml/0/dbm.rbs +151 -87
  204. data/stdlib/yaml/0/store.rbs +6 -0
  205. data/stdlib/zlib/0/zlib.rbs +90 -31
  206. metadata +18 -6
  207. data/lib/rbs/location.rb +0 -221
  208. data/sig/char_scanner.rbs +0 -9
data/core/errno.rbs CHANGED
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=error.c -->
1
2
  # Ruby exception objects are subclasses of Exception. However, operating
2
3
  # systems typically report errors using plain integers. Module Errno is created
3
4
  # dynamically to map these operating system errors to Ruby classes, with each
@@ -19,16 +20,6 @@
19
20
  # available as the constants of Errno.
20
21
  #
21
22
  # Errno.constants #=> :E2BIG, :EACCES, :EADDRINUSE, :EADDRNOTAVAIL, ...
22
- # System call error module used by webrick for cross platform compatibility.
23
- #
24
- # EPROTO
25
- # : protocol error
26
- # ECONNRESET
27
- # : remote host reset the connection request
28
- # ECONNABORTED
29
- # : Client sent TCP reset (RST) before server has accepted the connection
30
- # requested by client.
31
- #
32
23
  #
33
24
  module Errno
34
25
  end
data/core/errors.rbs CHANGED
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=error.c -->
1
2
  # Raised when the arguments are wrong and there isn't a more specific Exception
2
3
  # class.
3
4
  #
@@ -20,17 +21,20 @@
20
21
  class ArgumentError < StandardError
21
22
  end
22
23
 
24
+ # <!-- rdoc-file=thread_sync.c -->
23
25
  # The exception class which will be raised when pushing into a closed Queue.
24
- # See Queue#close and SizedQueue#close.
26
+ # See Thread::Queue#close and Thread::SizedQueue#close.
25
27
  #
26
28
  class ClosedQueueError < StopIteration
27
29
  end
28
30
 
31
+ # <!-- rdoc-file=error.c -->
29
32
  # EncodingError is the base class for encoding errors.
30
33
  #
31
34
  class EncodingError < StandardError
32
35
  end
33
36
 
37
+ # <!-- rdoc-file=io.c -->
34
38
  # Raised by some IO operations when reaching the end of file. Many IO methods
35
39
  # exist in two forms,
36
40
  #
@@ -47,6 +51,7 @@ end
47
51
  class EOFError < IOError
48
52
  end
49
53
 
54
+ # <!-- rdoc-file=numeric.c -->
50
55
  # Raised when attempting to convert special float values (in particular
51
56
  # `Infinity` or `NaN`) to numerical classes which don't support them.
52
57
  #
@@ -55,6 +60,7 @@ end
55
60
  class FloatDomainError < RangeError
56
61
  end
57
62
 
63
+ # <!-- rdoc-file=error.c -->
58
64
  # Raised when there is an attempt to modify a frozen object.
59
65
  #
60
66
  # [1, 2, 3].freeze << 4
@@ -64,6 +70,10 @@ end
64
70
  # FrozenError: can't modify frozen Array
65
71
  #
66
72
  class FrozenError[T] < RuntimeError
73
+ # <!--
74
+ # rdoc-file=error.c
75
+ # - FrozenError.new(msg=nil, receiver: nil) -> frozen_error
76
+ # -->
67
77
  # Construct a new FrozenError exception. If given the *receiver* parameter may
68
78
  # subsequently be examined using the FrozenError#receiver method.
69
79
  #
@@ -72,11 +82,16 @@ class FrozenError[T] < RuntimeError
72
82
  #
73
83
  def initialize: (?string? msg, ?receiver: T?) -> void
74
84
 
85
+ # <!--
86
+ # rdoc-file=error.c
87
+ # - frozen_error.receiver -> object
88
+ # -->
75
89
  # Return the receiver associated with this FrozenError exception.
76
90
  #
77
91
  def receiver: () -> T?
78
92
  end
79
93
 
94
+ # <!-- rdoc-file=error.c -->
80
95
  # Raised when the given index is invalid.
81
96
  #
82
97
  # a = [:foo, :bar]
@@ -87,6 +102,7 @@ end
87
102
  class IndexError < StandardError
88
103
  end
89
104
 
105
+ # <!-- rdoc-file=error.c -->
90
106
  # Raised when the interrupt signal is received, typically because the user has
91
107
  # pressed Control-C (on most posix platforms). As such, it is a subclass of
92
108
  # `SignalException`.
@@ -110,6 +126,7 @@ class Interrupt < SignalException
110
126
  def initialize: (?string) -> void
111
127
  end
112
128
 
129
+ # <!-- rdoc-file=io.c -->
113
130
  # Raised when an IO operation fails.
114
131
  #
115
132
  # File.open("/etc/hosts") {|f| f << "example"}
@@ -127,6 +144,7 @@ end
127
144
  class IOError < StandardError
128
145
  end
129
146
 
147
+ # <!-- rdoc-file=error.c -->
130
148
  # Raised when the specified key is not found. It is a subclass of IndexError.
131
149
  #
132
150
  # h = {"foo" => :bar}
@@ -134,19 +152,32 @@ end
134
152
  # h.fetch("baz") #=> KeyError: key not found: "baz"
135
153
  #
136
154
  class KeyError[K, R] < IndexError
155
+ # <!--
156
+ # rdoc-file=error.c
157
+ # - KeyError.new(message=nil, receiver: nil, key: nil) -> key_error
158
+ # -->
137
159
  # Construct a new `KeyError` exception with the given message, receiver and key.
138
160
  #
139
161
  def initialize: (?string msg, ?receiver: R?, ?key: K?) -> void
140
162
 
163
+ # <!--
164
+ # rdoc-file=error.c
165
+ # - key_error.key -> object
166
+ # -->
141
167
  # Return the key caused this KeyError exception.
142
168
  #
143
169
  def key: () -> K?
144
170
 
171
+ # <!--
172
+ # rdoc-file=error.c
173
+ # - key_error.receiver -> object
174
+ # -->
145
175
  # Return the receiver associated with this KeyError exception.
146
176
  #
147
177
  def receiver: () -> R?
148
178
  end
149
179
 
180
+ # <!-- rdoc-file=error.c -->
150
181
  # Raised when a file required (a Ruby script, extension library, ...) fails to
151
182
  # load.
152
183
  #
@@ -157,12 +188,13 @@ end
157
188
  # LoadError: no such file to load -- this/file/does/not/exist
158
189
  #
159
190
  class LoadError < ScriptError
191
+ # <!-- rdoc-file=error.c -->
160
192
  # the path failed to load
161
193
  #
162
- #
163
194
  def path: () -> String?
164
195
  end
165
196
 
197
+ # <!-- rdoc-file=proc.c -->
166
198
  # Raised when Ruby can't yield as requested.
167
199
  #
168
200
  # A typical scenario is attempting to yield when no block is given:
@@ -188,16 +220,25 @@ end
188
220
  # LocalJumpError: unexpected return
189
221
  #
190
222
  class LocalJumpError < StandardError
223
+ # <!--
224
+ # rdoc-file=proc.c
225
+ # - local_jump_error.exit_value -> obj
226
+ # -->
191
227
  # Returns the exit value associated with this `LocalJumpError`.
192
228
  #
193
229
  def exit_value: () -> untyped
194
230
 
231
+ # <!--
232
+ # rdoc-file=proc.c
233
+ # - local_jump_error.reason -> symbol
234
+ # -->
195
235
  # The reason this block was terminated: :break, :redo, :retry, :next, :return,
196
236
  # or :noreason.
197
237
  #
198
238
  def reason: () -> Symbol
199
239
  end
200
240
 
241
+ # <!-- rdoc-file=error.c -->
201
242
  # Raised when a given name is invalid or undefined.
202
243
  #
203
244
  # puts foo
@@ -215,6 +256,10 @@ end
215
256
  # NameError: wrong constant name answer
216
257
  #
217
258
  class NameError[T] < StandardError
259
+ # <!--
260
+ # rdoc-file=error.c
261
+ # - NameError.new(msg=nil, name=nil, receiver: nil) -> name_error
262
+ # -->
218
263
  # Construct a new NameError exception. If given the *name* parameter may
219
264
  # subsequently be examined using the NameError#name method. *receiver* parameter
220
265
  # allows to pass object in context of which the error happened. Example:
@@ -226,6 +271,10 @@ class NameError[T] < StandardError
226
271
 
227
272
  public
228
273
 
274
+ # <!--
275
+ # rdoc-file=error.c
276
+ # - name_error.local_variables -> array
277
+ # -->
229
278
  # Return a list of the local variable names defined where this NameError
230
279
  # exception was raised.
231
280
  #
@@ -233,20 +282,30 @@ class NameError[T] < StandardError
233
282
  #
234
283
  def local_variables: () -> ::Array[Symbol]
235
284
 
285
+ # <!--
286
+ # rdoc-file=error.c
287
+ # - name_error.name -> string or nil
288
+ # -->
236
289
  # Return the name associated with this NameError exception.
237
290
  #
238
291
  def name: () -> String?
239
292
 
293
+ # <!--
294
+ # rdoc-file=error.c
295
+ # - name_error.receiver -> object
296
+ # -->
240
297
  # Return the receiver associated with this NameError exception.
241
298
  #
242
299
  def receiver: () -> T?
243
300
  end
244
301
 
302
+ # <!-- rdoc-file=error.c -->
245
303
  # Raised when memory allocation fails.
246
304
  #
247
305
  class NoMemoryError < Exception
248
306
  end
249
307
 
308
+ # <!-- rdoc-file=error.c -->
250
309
  # Raised when a method is called on a receiver which doesn't have it defined and
251
310
  # also fails to respond with `method_missing`.
252
311
  #
@@ -257,6 +316,10 @@ end
257
316
  # NoMethodError: undefined method `to_ary' for "hello":String
258
317
  #
259
318
  class NoMethodError[T] < NameError[T]
319
+ # <!--
320
+ # rdoc-file=error.c
321
+ # - NoMethodError.new(msg=nil, name=nil, args=nil, private=false, receiver: nil) -> no_method_error
322
+ # -->
260
323
  # Construct a NoMethodError exception for a method of the given name called with
261
324
  # the given arguments. The name may be accessed using the `#name` method on the
262
325
  # resulting object, and the arguments using the `#args` method.
@@ -270,15 +333,24 @@ class NoMethodError[T] < NameError[T]
270
333
 
271
334
  public
272
335
 
336
+ # <!--
337
+ # rdoc-file=error.c
338
+ # - no_method_error.args -> obj
339
+ # -->
273
340
  # Return the arguments passed in as the third parameter to the constructor.
274
341
  #
275
342
  def args: () -> Array[untyped]
276
343
 
344
+ # <!--
345
+ # rdoc-file=error.c
346
+ # - no_method_error.private_call? -> true or false
347
+ # -->
277
348
  # Return true if the caused method was called as private.
278
349
  #
279
350
  def private_call?: () -> bool
280
351
  end
281
352
 
353
+ # <!-- rdoc-file=error.c -->
282
354
  # Raised when a feature is not implemented on the current platform. For example,
283
355
  # methods depending on the `fsync` or `fork` system calls may raise this
284
356
  # exception if the underlying operating system or Ruby runtime does not support
@@ -290,6 +362,7 @@ end
290
362
  class NotImplementedError < ScriptError
291
363
  end
292
364
 
365
+ # <!-- rdoc-file=error.c -->
293
366
  # Raised when a given numerical value is out of range.
294
367
  #
295
368
  # [1, 2, 3].drop(1 << 100)
@@ -301,6 +374,7 @@ end
301
374
  class RangeError < StandardError
302
375
  end
303
376
 
377
+ # <!-- rdoc-file=re.c -->
304
378
  # Raised when given an invalid regexp expression.
305
379
  #
306
380
  # Regexp.new("?")
@@ -312,6 +386,7 @@ end
312
386
  class RegexpError < StandardError
313
387
  end
314
388
 
389
+ # <!-- rdoc-file=error.c -->
315
390
  # A generic error class raised when an invalid operation is attempted.
316
391
  # Kernel#raise will raise a RuntimeError if no Exception class is specified.
317
392
  #
@@ -324,6 +399,7 @@ end
324
399
  class RuntimeError < StandardError
325
400
  end
326
401
 
402
+ # <!-- rdoc-file=error.c -->
327
403
  # ScriptError is the superclass for errors raised when a script can not be
328
404
  # executed because of a `LoadError`, `NotImplementedError` or a `SyntaxError`.
329
405
  # Note these type of `ScriptErrors` are not `StandardError` and will not be
@@ -332,11 +408,13 @@ end
332
408
  class ScriptError < Exception
333
409
  end
334
410
 
411
+ # <!-- rdoc-file=error.c -->
335
412
  # No longer used by internal code.
336
413
  #
337
414
  class SecurityError < Exception
338
415
  end
339
416
 
417
+ # <!-- rdoc-file=error.c -->
340
418
  # Raised when a signal is received.
341
419
  #
342
420
  # begin
@@ -351,6 +429,11 @@ end
351
429
  # received Exception SIGHUP
352
430
  #
353
431
  class SignalException < Exception
432
+ # <!--
433
+ # rdoc-file=signal.c
434
+ # - SignalException.new(sig_name) -> signal_exception
435
+ # - SignalException.new(sig_number [, name]) -> signal_exception
436
+ # -->
354
437
  # Construct a new SignalException object. `sig_name` should be a known signal
355
438
  # name.
356
439
  #
@@ -361,11 +444,16 @@ class SignalException < Exception
361
444
 
362
445
  def signm: () -> String
363
446
 
447
+ # <!--
448
+ # rdoc-file=signal.c
449
+ # - signal_exception.signo -> num
450
+ # -->
364
451
  # Returns a signal number.
365
452
  #
366
453
  def signo: () -> Integer
367
454
  end
368
455
 
456
+ # <!-- rdoc-file=error.c -->
369
457
  # The most standard error types are subclasses of StandardError. A rescue clause
370
458
  # without an explicit Exception class will rescue all StandardErrors (and only
371
459
  # those).
@@ -386,6 +474,7 @@ end
386
474
  class StandardError < Exception
387
475
  end
388
476
 
477
+ # <!-- rdoc-file=enumerator.c -->
389
478
  # Raised to stop the iteration, in particular by Enumerator#next. It is rescued
390
479
  # by Kernel#loop.
391
480
  #
@@ -402,6 +491,10 @@ end
402
491
  # Done!
403
492
  #
404
493
  class StopIteration < IndexError
494
+ # <!--
495
+ # rdoc-file=enumerator.c
496
+ # - result -> value
497
+ # -->
405
498
  # Returns the return value of the iterator.
406
499
  #
407
500
  # o = Object.new
@@ -427,6 +520,7 @@ class StopIteration < IndexError
427
520
  def result: () -> untyped
428
521
  end
429
522
 
523
+ # <!-- rdoc-file=error.c -->
430
524
  # Raised when encountering Ruby code with an invalid syntax.
431
525
  #
432
526
  # eval("1+1=2")
@@ -436,11 +530,16 @@ end
436
530
  # SyntaxError: (eval):1: syntax error, unexpected '=', expecting $end
437
531
  #
438
532
  class SyntaxError < ScriptError
533
+ # <!--
534
+ # rdoc-file=error.c
535
+ # - SyntaxError.new([msg]) -> syntax_error
536
+ # -->
439
537
  # Construct a SyntaxError exception.
440
538
  #
441
539
  def initialize: (?string msg) -> void
442
540
  end
443
541
 
542
+ # <!-- rdoc-file=error.c -->
444
543
  # SystemCallError is the base class for all low-level platform-dependent errors.
445
544
  #
446
545
  # The errors available on the current platform are subclasses of SystemCallError
@@ -453,6 +552,10 @@ end
453
552
  # Errno::ENOENT: No such file or directory - does/not/exist
454
553
  #
455
554
  class SystemCallError < StandardError
555
+ # <!--
556
+ # rdoc-file=error.c
557
+ # - SystemCallError.new(msg, errno) -> system_call_error_subclass
558
+ # -->
456
559
  # If *errno* corresponds to a known system error code, constructs the
457
560
  # appropriate Errno class for that error, otherwise constructs a generic
458
561
  # SystemCallError object. The error number is subsequently available via the
@@ -460,6 +563,10 @@ class SystemCallError < StandardError
460
563
  #
461
564
  def initialize: (string msg, Integer errno) -> SystemCallError
462
565
 
566
+ # <!--
567
+ # rdoc-file=error.c
568
+ # - system_call_error === other -> true or false
569
+ # -->
463
570
  # Return `true` if the receiver is a generic `SystemCallError`, or if the error
464
571
  # numbers `self` and *other* are the same.
465
572
  #
@@ -467,14 +574,26 @@ class SystemCallError < StandardError
467
574
 
468
575
  public
469
576
 
577
+ # <!--
578
+ # rdoc-file=error.c
579
+ # - system_call_error.errno -> integer
580
+ # -->
470
581
  # Return this SystemCallError's error number.
471
582
  #
472
583
  def errno: () -> Integer
473
584
  end
474
585
 
586
+ # <!-- rdoc-file=error.c -->
475
587
  # Raised by `exit` to initiate the termination of the script.
476
588
  #
477
589
  class SystemExit < Exception
590
+ # <!--
591
+ # rdoc-file=error.c
592
+ # - SystemExit.new -> system_exit
593
+ # - SystemExit.new(status) -> system_exit
594
+ # - SystemExit.new(status, msg) -> system_exit
595
+ # - SystemExit.new(msg) -> system_exit
596
+ # -->
478
597
  # Create a new `SystemExit` exception with the given status and message. Status
479
598
  # is true, false, or an integer. If status is not given, true is used.
480
599
  #
@@ -484,15 +603,24 @@ class SystemExit < Exception
484
603
 
485
604
  public
486
605
 
606
+ # <!--
607
+ # rdoc-file=error.c
608
+ # - system_exit.status -> integer
609
+ # -->
487
610
  # Return the status value associated with this system exit.
488
611
  #
489
612
  def status: () -> Integer
490
613
 
614
+ # <!--
615
+ # rdoc-file=error.c
616
+ # - system_exit.success? -> true or false
617
+ # -->
491
618
  # Returns `true` if exiting successful, `false` if not.
492
619
  #
493
620
  def success?: () -> bool
494
621
  end
495
622
 
623
+ # <!-- rdoc-file=proc.c -->
496
624
  # Raised in case of a stack overflow.
497
625
  #
498
626
  # def me_myself_and_i
@@ -507,6 +635,7 @@ end
507
635
  class SystemStackError < Exception
508
636
  end
509
637
 
638
+ # <!-- rdoc-file=thread.c -->
510
639
  # Raised when an invalid operation is attempted on a thread.
511
640
  #
512
641
  # For example, when no other thread has been started:
@@ -521,6 +650,7 @@ end
521
650
  class ThreadError < StandardError
522
651
  end
523
652
 
653
+ # <!-- rdoc-file=error.c -->
524
654
  # Raised when encountering an object that is not of the expected type.
525
655
  #
526
656
  # [1, 2, 3].first("two")
@@ -532,6 +662,7 @@ end
532
662
  class TypeError < StandardError
533
663
  end
534
664
 
665
+ # <!-- rdoc-file=vm_eval.c -->
535
666
  # Raised when `throw` is called with a *tag* which does not have corresponding
536
667
  # `catch` block.
537
668
  #
@@ -542,6 +673,12 @@ end
542
673
  # UncaughtThrowError: uncaught throw "foo"
543
674
  #
544
675
  class UncaughtThrowError < ArgumentError
676
+ # <!--
677
+ # rdoc-file=vm_eval.c
678
+ # - new(*args)
679
+ # -->
680
+ # Document-class: UncaughtThrowError
681
+ #
545
682
  # Raised when `throw` is called with a *tag* which does not have corresponding
546
683
  # `catch` block.
547
684
  #
@@ -555,19 +692,32 @@ class UncaughtThrowError < ArgumentError
555
692
 
556
693
  public
557
694
 
695
+ # <!--
696
+ # rdoc-file=vm_eval.c
697
+ # - uncaught_throw.tag -> obj
698
+ # -->
558
699
  # Return the tag object which was called for.
559
700
  #
560
701
  def tag: () -> untyped
561
702
 
703
+ # <!--
704
+ # rdoc-file=vm_eval.c
705
+ # - uncaught_throw.to_s -> string
706
+ # -->
562
707
  # Returns formatted message with the inspected tag.
563
708
  #
564
709
  def to_s: () -> String
565
710
 
711
+ # <!--
712
+ # rdoc-file=vm_eval.c
713
+ # - uncaught_throw.value -> obj
714
+ # -->
566
715
  # Return the return value which was called for.
567
716
  #
568
717
  def value: () -> untyped
569
718
  end
570
719
 
720
+ # <!-- rdoc-file=numeric.c -->
571
721
  # Raised when attempting to divide an integer by 0.
572
722
  #
573
723
  # 42 / 0 #=> ZeroDivisionError: divided by 0