rbs 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +6 -1
  5. data/core/array.rbs +2866 -1086
  6. data/core/basic_object.rbs +150 -30
  7. data/core/binding.rbs +33 -0
  8. data/core/builtin.rbs +4 -4
  9. data/core/class.rbs +43 -5
  10. data/core/comparable.rbs +57 -0
  11. data/core/complex.rbs +170 -4
  12. data/core/constants.rbs +51 -0
  13. data/core/deprecated.rbs +7 -0
  14. data/core/dir.rbs +305 -20
  15. data/core/encoding.rbs +472 -77
  16. data/core/enumerable.rbs +2173 -234
  17. data/core/enumerator.rbs +448 -182
  18. data/core/env.rbs +448 -1
  19. data/core/errno.rbs +1 -10
  20. data/core/errors.rbs +152 -2
  21. data/core/exception.rbs +201 -127
  22. data/core/false_class.rbs +27 -0
  23. data/core/fiber.rbs +118 -37
  24. data/core/fiber_error.rbs +8 -9
  25. data/core/file.rbs +1059 -139
  26. data/core/file_test.rbs +287 -32
  27. data/core/float.rbs +776 -300
  28. data/core/gc.rbs +185 -34
  29. data/core/global_variables.rbs +5 -1
  30. data/core/hash.rbs +1582 -649
  31. data/core/integer.rbs +974 -204
  32. data/core/io/buffer.rbs +710 -0
  33. data/core/io/wait.rbs +29 -8
  34. data/core/io.rbs +2438 -417
  35. data/core/kernel.rbs +2315 -316
  36. data/core/marshal.rbs +37 -2
  37. data/core/match_data.rbs +123 -6
  38. data/core/math.rbs +126 -6
  39. data/core/method.rbs +226 -102
  40. data/core/module.rbs +421 -45
  41. data/core/nil_class.rbs +64 -0
  42. data/core/numeric.rbs +620 -142
  43. data/core/object.rbs +453 -81
  44. data/core/object_space.rbs +92 -2
  45. data/core/proc.rbs +482 -285
  46. data/core/process.rbs +443 -34
  47. data/core/ractor.rbs +232 -9
  48. data/core/random.rbs +151 -52
  49. data/core/range.rbs +885 -160
  50. data/core/rational.rbs +122 -6
  51. data/core/rb_config.rbs +14 -4
  52. data/core/refinement.rbs +44 -0
  53. data/core/regexp.rbs +156 -14
  54. data/core/ruby_vm.rbs +42 -3
  55. data/core/signal.rbs +78 -39
  56. data/core/string.rbs +2123 -567
  57. data/core/string_io.rbs +204 -0
  58. data/core/struct.rbs +283 -28
  59. data/core/symbol.rbs +304 -30
  60. data/core/thread.rbs +1288 -688
  61. data/core/thread_group.rbs +66 -10
  62. data/core/time.rbs +643 -217
  63. data/core/trace_point.rbs +100 -12
  64. data/core/true_class.rbs +24 -0
  65. data/core/unbound_method.rbs +73 -7
  66. data/core/warning.rbs +37 -12
  67. data/docs/CONTRIBUTING.md +40 -34
  68. data/docs/stdlib.md +3 -102
  69. data/lib/rbs/annotate/annotations.rb +197 -0
  70. data/lib/rbs/annotate/formatter.rb +80 -0
  71. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  72. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  73. data/lib/rbs/annotate.rb +6 -0
  74. data/lib/rbs/cli.rb +45 -1
  75. data/lib/rbs/definition_builder.rb +5 -1
  76. data/lib/rbs/location_aux.rb +12 -0
  77. data/lib/rbs/prototype/rb.rb +12 -0
  78. data/lib/rbs/version.rb +1 -1
  79. data/sig/annotate/annotations.rbs +102 -0
  80. data/sig/annotate/formatter.rbs +24 -0
  81. data/sig/annotate/rdoc_annotater.rbs +82 -0
  82. data/sig/annotate/rdoc_source.rbs +30 -0
  83. data/sig/cli.rbs +2 -0
  84. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  85. data/sig/location.rbs +6 -0
  86. data/sig/method_types.rbs +5 -1
  87. data/sig/polyfill.rbs +78 -0
  88. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  89. data/stdlib/abbrev/0/array.rbs +26 -0
  90. data/stdlib/base64/0/base64.rbs +31 -0
  91. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  92. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  93. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  94. data/stdlib/cgi/0/core.rbs +59 -0
  95. data/stdlib/coverage/0/coverage.rbs +164 -2
  96. data/stdlib/csv/0/csv.rbs +2862 -398
  97. data/stdlib/date/0/date.rbs +483 -25
  98. data/stdlib/date/0/date_time.rbs +187 -12
  99. data/stdlib/dbm/0/dbm.rbs +152 -17
  100. data/stdlib/digest/0/digest.rbs +146 -0
  101. data/stdlib/erb/0/erb.rbs +65 -245
  102. data/stdlib/fiber/0/fiber.rbs +73 -91
  103. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  104. data/stdlib/find/0/find.rbs +9 -0
  105. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  106. data/stdlib/io-console/0/io-console.rbs +227 -15
  107. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  108. data/stdlib/json/0/json.rbs +1146 -144
  109. data/stdlib/logger/0/formatter.rbs +24 -0
  110. data/stdlib/logger/0/log_device.rbs +64 -0
  111. data/stdlib/logger/0/logger.rbs +165 -13
  112. data/stdlib/logger/0/period.rbs +10 -0
  113. data/stdlib/logger/0/severity.rbs +26 -0
  114. data/stdlib/monitor/0/monitor.rbs +163 -0
  115. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  116. data/stdlib/net-http/0/net-http.rbs +1492 -683
  117. data/stdlib/nkf/0/nkf.rbs +372 -0
  118. data/stdlib/objspace/0/objspace.rbs +149 -90
  119. data/stdlib/openssl/0/openssl.rbs +8108 -71
  120. data/stdlib/optparse/0/optparse.rbs +487 -19
  121. data/stdlib/pathname/0/pathname.rbs +425 -124
  122. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  123. data/stdlib/prime/0/integer-extension.rbs +20 -2
  124. data/stdlib/prime/0/prime.rbs +88 -21
  125. data/stdlib/pstore/0/pstore.rbs +102 -0
  126. data/stdlib/pty/0/pty.rbs +64 -14
  127. data/stdlib/resolv/0/resolv.rbs +420 -31
  128. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  129. data/stdlib/rubygems/0/config_file.rbs +33 -1
  130. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  131. data/stdlib/rubygems/0/installer.rbs +13 -1
  132. data/stdlib/rubygems/0/path_support.rbs +4 -1
  133. data/stdlib/rubygems/0/platform.rbs +5 -1
  134. data/stdlib/rubygems/0/request_set.rbs +44 -2
  135. data/stdlib/rubygems/0/requirement.rbs +65 -2
  136. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  137. data/stdlib/rubygems/0/source_list.rbs +13 -0
  138. data/stdlib/rubygems/0/specification.rbs +21 -1
  139. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  140. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  141. data/stdlib/rubygems/0/version.rbs +60 -157
  142. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  143. data/stdlib/set/0/set.rbs +420 -106
  144. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  145. data/stdlib/singleton/0/singleton.rbs +20 -0
  146. data/stdlib/socket/0/addrinfo.rbs +210 -9
  147. data/stdlib/socket/0/basic_socket.rbs +103 -11
  148. data/stdlib/socket/0/ip_socket.rbs +31 -9
  149. data/stdlib/socket/0/socket.rbs +586 -38
  150. data/stdlib/socket/0/tcp_server.rbs +22 -2
  151. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  152. data/stdlib/socket/0/udp_socket.rbs +25 -2
  153. data/stdlib/socket/0/unix_server.rbs +22 -2
  154. data/stdlib/socket/0/unix_socket.rbs +45 -5
  155. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  156. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  157. data/stdlib/time/0/time.rbs +208 -116
  158. data/stdlib/timeout/0/timeout.rbs +10 -0
  159. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  160. data/stdlib/tsort/0/cyclic.rbs +1 -0
  161. data/stdlib/tsort/0/interfaces.rbs +1 -0
  162. data/stdlib/tsort/0/tsort.rbs +42 -0
  163. data/stdlib/uri/0/common.rbs +57 -8
  164. data/stdlib/uri/0/file.rbs +55 -109
  165. data/stdlib/uri/0/ftp.rbs +6 -3
  166. data/stdlib/uri/0/generic.rbs +556 -327
  167. data/stdlib/uri/0/http.rbs +26 -115
  168. data/stdlib/uri/0/https.rbs +8 -102
  169. data/stdlib/uri/0/ldap.rbs +143 -137
  170. data/stdlib/uri/0/ldaps.rbs +8 -102
  171. data/stdlib/uri/0/mailto.rbs +3 -0
  172. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  173. data/stdlib/uri/0/ws.rbs +6 -3
  174. data/stdlib/uri/0/wss.rbs +5 -3
  175. data/stdlib/yaml/0/dbm.rbs +151 -87
  176. data/stdlib/yaml/0/store.rbs +6 -0
  177. data/stdlib/zlib/0/zlib.rbs +90 -31
  178. metadata +17 -5
  179. data/lib/rbs/location.rb +0 -221
data/core/complex.rbs CHANGED
@@ -1,7 +1,18 @@
1
+ # <!-- rdoc-file=complex.c -->
1
2
  # A complex number can be represented as a paired real number with imaginary
2
3
  # unit; a+bi. Where a is real part, b is imaginary part and i is imaginary
3
4
  # unit. Real a equals complex a+0i mathematically.
4
5
  #
6
+ # You can create a Complex object explicitly with:
7
+ #
8
+ # * A [complex literal](doc/syntax/literals_rdoc.html#label-Complex+Literals).
9
+ #
10
+ #
11
+ # You can convert certain objects to Complex objects with:
12
+ #
13
+ # * Method [Complex](Kernel.html#method-i-Complex).
14
+ #
15
+ #
5
16
  # Complex object can be created as literal, and also by using Kernel#Complex,
6
17
  # Complex::rect, Complex::polar or to_c method.
7
18
  #
@@ -29,6 +40,10 @@
29
40
  # Complex(1, 1) / 2.0 #=> (0.5+0.5i)
30
41
  #
31
42
  class Complex < Numeric
43
+ # <!--
44
+ # rdoc-file=complex.c
45
+ # - Complex.polar(abs[, arg]) -> complex
46
+ # -->
32
47
  # Returns a complex object which denotes the given polar form.
33
48
  #
34
49
  # Complex.polar(3, 0) #=> (3.0+0.0i)
@@ -38,12 +53,22 @@ class Complex < Numeric
38
53
  #
39
54
  def self.polar: (Numeric, ?Numeric) -> Complex
40
55
 
56
+ # <!--
57
+ # rdoc-file=complex.c
58
+ # - Complex.rect(real[, imag]) -> complex
59
+ # - Complex.rectangular(real[, imag]) -> complex
60
+ # -->
41
61
  # Returns a complex object which denotes the given rectangular form.
42
62
  #
43
63
  # Complex.rectangular(1, 2) #=> (1+2i)
44
64
  #
45
65
  def self.rect: (Numeric, ?Numeric) -> Complex
46
66
 
67
+ # <!--
68
+ # rdoc-file=complex.c
69
+ # - Complex.rect(real[, imag]) -> complex
70
+ # - Complex.rectangular(real[, imag]) -> complex
71
+ # -->
47
72
  # Returns a complex object which denotes the given rectangular form.
48
73
  #
49
74
  # Complex.rectangular(1, 2) #=> (1+2i)
@@ -52,6 +77,10 @@ class Complex < Numeric
52
77
 
53
78
  public
54
79
 
80
+ # <!--
81
+ # rdoc-file=complex.c
82
+ # - cmp * numeric -> complex
83
+ # -->
55
84
  # Performs multiplication.
56
85
  #
57
86
  # Complex(2, 3) * Complex(2, 3) #=> (-5+12i)
@@ -62,6 +91,10 @@ class Complex < Numeric
62
91
  #
63
92
  def *: (Numeric) -> Complex
64
93
 
94
+ # <!--
95
+ # rdoc-file=complex.c
96
+ # - cmp ** numeric -> complex
97
+ # -->
65
98
  # Performs exponentiation.
66
99
  #
67
100
  # Complex('i') ** 2 #=> (-1+0i)
@@ -69,6 +102,10 @@ class Complex < Numeric
69
102
  #
70
103
  def **: (Numeric) -> Complex
71
104
 
105
+ # <!--
106
+ # rdoc-file=complex.c
107
+ # - cmp + numeric -> complex
108
+ # -->
72
109
  # Performs addition.
73
110
  #
74
111
  # Complex(2, 3) + Complex(2, 3) #=> (4+6i)
@@ -81,6 +118,10 @@ class Complex < Numeric
81
118
 
82
119
  def +@: () -> Complex
83
120
 
121
+ # <!--
122
+ # rdoc-file=complex.c
123
+ # - cmp - numeric -> complex
124
+ # -->
84
125
  # Performs subtraction.
85
126
  #
86
127
  # Complex(2, 3) - Complex(2, 3) #=> (0+0i)
@@ -91,12 +132,21 @@ class Complex < Numeric
91
132
  #
92
133
  def -: (Numeric) -> Complex
93
134
 
135
+ # <!--
136
+ # rdoc-file=complex.c
137
+ # - -cmp -> complex
138
+ # -->
94
139
  # Returns negation of the value.
95
140
  #
96
141
  # -Complex(1, 2) #=> (-1-2i)
97
142
  #
98
143
  def -@: () -> Complex
99
144
 
145
+ # <!--
146
+ # rdoc-file=complex.c
147
+ # - cmp / numeric -> complex
148
+ # - cmp.quo(numeric) -> complex
149
+ # -->
100
150
  # Performs division.
101
151
  #
102
152
  # Complex(2, 3) / Complex(2, 3) #=> ((1/1)+(0/1)*i)
@@ -111,6 +161,10 @@ class Complex < Numeric
111
161
 
112
162
  def <=: (Numeric) -> bot
113
163
 
164
+ # <!--
165
+ # rdoc-file=complex.c
166
+ # - cmp <=> object -> 0, 1, -1, or nil
167
+ # -->
114
168
  # If `cmp`'s imaginary part is zero, and `object` is also a real number (or a
115
169
  # Complex number where the imaginary part is zero), compare the real part of
116
170
  # `cmp` to object. Otherwise, return nil.
@@ -123,6 +177,10 @@ class Complex < Numeric
123
177
  #
124
178
  def <=>: (untyped) -> Integer?
125
179
 
180
+ # <!--
181
+ # rdoc-file=complex.c
182
+ # - cmp == object -> true or false
183
+ # -->
126
184
  # Returns true if cmp equals object numerically.
127
185
  #
128
186
  # Complex(2, 3) == Complex(2, 3) #=> true
@@ -137,6 +195,11 @@ class Complex < Numeric
137
195
 
138
196
  def >=: (Numeric) -> bot
139
197
 
198
+ # <!--
199
+ # rdoc-file=complex.c
200
+ # - cmp.abs -> real
201
+ # - cmp.magnitude -> real
202
+ # -->
140
203
  # Returns the absolute part of its polar form.
141
204
  #
142
205
  # Complex(-1).abs #=> 1
@@ -144,6 +207,10 @@ class Complex < Numeric
144
207
  #
145
208
  def abs: () -> Numeric
146
209
 
210
+ # <!--
211
+ # rdoc-file=complex.c
212
+ # - cmp.abs2 -> real
213
+ # -->
147
214
  # Returns square of the absolute value.
148
215
  #
149
216
  # Complex(-1).abs2 #=> 1
@@ -151,12 +218,19 @@ class Complex < Numeric
151
218
  #
152
219
  def abs2: () -> Numeric
153
220
 
221
+ # <!-- rdoc-file=complex.c -->
154
222
  # Returns the angle part of its polar form.
155
223
  #
156
224
  # Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966
157
225
  #
158
226
  def angle: () -> Float
159
227
 
228
+ # <!--
229
+ # rdoc-file=complex.c
230
+ # - cmp.arg -> float
231
+ # - cmp.angle -> float
232
+ # - cmp.phase -> float
233
+ # -->
160
234
  # Returns the angle part of its polar form.
161
235
  #
162
236
  # Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966
@@ -167,18 +241,28 @@ class Complex < Numeric
167
241
 
168
242
  def coerce: (Numeric) -> [ Complex, Complex ]
169
243
 
244
+ # <!-- rdoc-file=complex.c -->
170
245
  # Returns the complex conjugate.
171
246
  #
172
247
  # Complex(1, 2).conjugate #=> (1-2i)
173
248
  #
174
249
  def conj: () -> Complex
175
250
 
251
+ # <!--
252
+ # rdoc-file=complex.c
253
+ # - cmp.conj -> complex
254
+ # - cmp.conjugate -> complex
255
+ # -->
176
256
  # Returns the complex conjugate.
177
257
  #
178
258
  # Complex(1, 2).conjugate #=> (1-2i)
179
259
  #
180
260
  def conjugate: () -> Complex
181
261
 
262
+ # <!--
263
+ # rdoc-file=complex.c
264
+ # - cmp.denominator -> integer
265
+ # -->
182
266
  # Returns the denominator (lcm of both denominator - real and imag).
183
267
  #
184
268
  # See numerator.
@@ -193,12 +277,20 @@ class Complex < Numeric
193
277
 
194
278
  def eql?: (untyped) -> bool
195
279
 
280
+ # <!--
281
+ # rdoc-file=complex.c
282
+ # - cmp.fdiv(numeric) -> complex
283
+ # -->
196
284
  # Performs division as each part is a float, never returns a float.
197
285
  #
198
286
  # Complex(11, 22).fdiv(3) #=> (3.6666666666666665+7.333333333333333i)
199
287
  #
200
288
  def fdiv: (Numeric) -> Complex
201
289
 
290
+ # <!--
291
+ # rdoc-file=complex.c
292
+ # - cmp.finite? -> true or false
293
+ # -->
202
294
  # Returns `true` if `cmp`'s real and imaginary parts are both finite numbers,
203
295
  # otherwise returns `false`.
204
296
  #
@@ -206,10 +298,16 @@ class Complex < Numeric
206
298
 
207
299
  def floor: (?Integer) -> bot
208
300
 
301
+ # <!--
302
+ # rdoc-file=complex.c
303
+ # - hash()
304
+ # -->
305
+ #
209
306
  def hash: () -> Integer
210
307
 
211
308
  def i: () -> bot
212
309
 
310
+ # <!-- rdoc-file=complex.c -->
213
311
  # Returns the imaginary part.
214
312
  #
215
313
  # Complex(7).imaginary #=> 0
@@ -217,6 +315,11 @@ class Complex < Numeric
217
315
  #
218
316
  def imag: () -> Numeric
219
317
 
318
+ # <!--
319
+ # rdoc-file=complex.c
320
+ # - cmp.imag -> real
321
+ # - cmp.imaginary -> real
322
+ # -->
220
323
  # Returns the imaginary part.
221
324
  #
222
325
  # Complex(7).imaginary #=> 0
@@ -224,6 +327,10 @@ class Complex < Numeric
224
327
  #
225
328
  def imaginary: () -> Numeric
226
329
 
330
+ # <!--
331
+ # rdoc-file=complex.c
332
+ # - cmp.infinite? -> nil or 1
333
+ # -->
227
334
  # Returns `1` if `cmp`'s real or imaginary part is an infinite number, otherwise
228
335
  # returns `nil`.
229
336
  #
@@ -234,6 +341,10 @@ class Complex < Numeric
234
341
  #
235
342
  def infinite?: () -> Integer?
236
343
 
344
+ # <!--
345
+ # rdoc-file=complex.c
346
+ # - cmp.inspect -> string
347
+ # -->
237
348
  # Returns the value as a string for inspection.
238
349
  #
239
350
  # Complex(2).inspect #=> "(2+0i)"
@@ -246,6 +357,7 @@ class Complex < Numeric
246
357
 
247
358
  def integer?: () -> bool
248
359
 
360
+ # <!-- rdoc-file=complex.c -->
249
361
  # Returns the absolute part of its polar form.
250
362
  #
251
363
  # Complex(-1).abs #=> 1
@@ -259,6 +371,10 @@ class Complex < Numeric
259
371
 
260
372
  def nonzero?: () -> self?
261
373
 
374
+ # <!--
375
+ # rdoc-file=complex.c
376
+ # - cmp.numerator -> numeric
377
+ # -->
262
378
  # Returns the numerator.
263
379
  #
264
380
  # 1 2 3+4i <- numerator
@@ -276,20 +392,30 @@ class Complex < Numeric
276
392
  #
277
393
  def numerator: () -> Complex
278
394
 
395
+ # <!-- rdoc-file=complex.c -->
279
396
  # Returns the angle part of its polar form.
280
397
  #
281
398
  # Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966
282
399
  #
283
400
  alias phase angle
284
401
 
402
+ # <!--
403
+ # rdoc-file=complex.c
404
+ # - cmp.polar -> array
405
+ # -->
285
406
  # Returns an array; [cmp.abs, cmp.arg].
286
407
  #
287
408
  # Complex(1, 2).polar #=> [2.23606797749979, 1.1071487177940904]
288
409
  #
289
- def polar: () -> [Numeric, Float]
410
+ def polar: () -> [ Numeric, Float ]
290
411
 
291
412
  def positive?: () -> bot
292
413
 
414
+ # <!--
415
+ # rdoc-file=complex.c
416
+ # - cmp / numeric -> complex
417
+ # - cmp.quo(numeric) -> complex
418
+ # -->
293
419
  # Performs division.
294
420
  #
295
421
  # Complex(2, 3) / Complex(2, 3) #=> ((1/1)+(0/1)*i)
@@ -300,6 +426,10 @@ class Complex < Numeric
300
426
  #
301
427
  def quo: (Numeric) -> Complex
302
428
 
429
+ # <!--
430
+ # rdoc-file=complex.c
431
+ # - cmp.rationalize([eps]) -> rational
432
+ # -->
303
433
  # Returns the value as a rational if possible (the imaginary part should be
304
434
  # exactly zero).
305
435
  #
@@ -311,6 +441,10 @@ class Complex < Numeric
311
441
  #
312
442
  def rationalize: (?Numeric eps) -> Rational
313
443
 
444
+ # <!--
445
+ # rdoc-file=complex.c
446
+ # - cmp.real -> real
447
+ # -->
314
448
  # Returns the real part.
315
449
  #
316
450
  # Complex(7).real #=> 7
@@ -318,16 +452,27 @@ class Complex < Numeric
318
452
  #
319
453
  def real: () -> Numeric
320
454
 
455
+ # <!--
456
+ # rdoc-file=complex.c
457
+ # - Complex(1).real? -> false
458
+ # - Complex(1, 2).real? -> false
459
+ # -->
321
460
  # Returns false, even if the complex number has no imaginary part.
322
461
  #
323
462
  def real?: () -> false
324
463
 
325
- # Returns an array; [cmp.real, cmp.imag].
464
+ # <!-- rdoc-file=complex.c -->
465
+ # Returns a complex object which denotes the given rectangular form.
326
466
  #
327
- # Complex(1, 2).rectangular #=> [1, 2]
467
+ # Complex.rectangular(1, 2) #=> (1+2i)
328
468
  #
329
- def rect: () -> [Numeric, Numeric]
469
+ def rect: () -> [ Numeric, Numeric ]
330
470
 
471
+ # <!--
472
+ # rdoc-file=complex.c
473
+ # - cmp.rect -> array
474
+ # - cmp.rectangular -> array
475
+ # -->
331
476
  # Returns an array; [cmp.real, cmp.imag].
332
477
  #
333
478
  # Complex(1, 2).rectangular #=> [1, 2]
@@ -340,6 +485,10 @@ class Complex < Numeric
340
485
 
341
486
  def step: (*untyped) ?{ (*untyped) -> untyped } -> bot
342
487
 
488
+ # <!--
489
+ # rdoc-file=complex.c
490
+ # - complex.to_c -> self
491
+ # -->
343
492
  # Returns self.
344
493
  #
345
494
  # Complex(2).to_c #=> (2+0i)
@@ -347,6 +496,10 @@ class Complex < Numeric
347
496
  #
348
497
  def to_c: () -> Complex
349
498
 
499
+ # <!--
500
+ # rdoc-file=complex.c
501
+ # - cmp.to_f -> float
502
+ # -->
350
503
  # Returns the value as a float if possible (the imaginary part should be exactly
351
504
  # zero).
352
505
  #
@@ -356,6 +509,10 @@ class Complex < Numeric
356
509
  #
357
510
  def to_f: () -> Float
358
511
 
512
+ # <!--
513
+ # rdoc-file=complex.c
514
+ # - cmp.to_i -> integer
515
+ # -->
359
516
  # Returns the value as an integer if possible (the imaginary part should be
360
517
  # exactly zero).
361
518
  #
@@ -367,6 +524,10 @@ class Complex < Numeric
367
524
 
368
525
  alias to_int to_i
369
526
 
527
+ # <!--
528
+ # rdoc-file=complex.c
529
+ # - cmp.to_r -> rational
530
+ # -->
370
531
  # Returns the value as a rational if possible (the imaginary part should be
371
532
  # exactly zero).
372
533
  #
@@ -378,6 +539,10 @@ class Complex < Numeric
378
539
  #
379
540
  def to_r: () -> Rational
380
541
 
542
+ # <!--
543
+ # rdoc-file=complex.c
544
+ # - cmp.to_s -> string
545
+ # -->
381
546
  # Returns the value as a string.
382
547
  #
383
548
  # Complex(2).to_s #=> "2+0i"
@@ -393,6 +558,7 @@ class Complex < Numeric
393
558
  def zero?: () -> bool
394
559
  end
395
560
 
561
+ # <!-- rdoc-file=complex.c -->
396
562
  # The imaginary unit.
397
563
  #
398
564
  Complex::I: Complex
data/core/constants.rbs CHANGED
@@ -1,5 +1,16 @@
1
+ # <!-- rdoc-file=io.c -->
2
+ # ARGF is a stream designed for use in scripts that process files given as
3
+ # command-line arguments or passed in via STDIN.
4
+ #
5
+ # See ARGF (the class) for more details.
6
+ #
1
7
  ::ARGF: Object
2
8
 
9
+ # <!-- rdoc-file=ruby.c -->
10
+ # ARGV contains the command line arguments used to run ruby.
11
+ #
12
+ # A library like OptionParser can be used to process command-line arguments.
13
+ #
3
14
  ::ARGV: Array[String]
4
15
 
5
16
  ::CROSS_COMPILING: NilClass
@@ -8,30 +19,70 @@
8
19
 
9
20
  ::NIL: NilClass
10
21
 
22
+ # <!-- rdoc-file=version.c -->
23
+ # The copyright string for ruby
24
+ #
11
25
  ::RUBY_COPYRIGHT: String
12
26
 
27
+ # <!-- rdoc-file=version.c -->
28
+ # The full ruby version string, like `ruby -v` prints
29
+ #
13
30
  ::RUBY_DESCRIPTION: String
14
31
 
32
+ # <!-- rdoc-file=version.c -->
33
+ # The engine or interpreter this ruby uses.
34
+ #
15
35
  ::RUBY_ENGINE: String
16
36
 
37
+ # <!-- rdoc-file=version.c -->
38
+ # The version of the engine or interpreter this ruby uses.
39
+ #
17
40
  ::RUBY_ENGINE_VERSION: String
18
41
 
42
+ # <!-- rdoc-file=version.c -->
43
+ # The patchlevel for this ruby. If this is a development build of ruby the
44
+ # patchlevel will be -1
45
+ #
19
46
  ::RUBY_PATCHLEVEL: Integer
20
47
 
48
+ # <!-- rdoc-file=version.c -->
49
+ # The platform for this ruby
50
+ #
21
51
  ::RUBY_PLATFORM: String
22
52
 
53
+ # <!-- rdoc-file=version.c -->
54
+ # The date this ruby was released
55
+ #
23
56
  ::RUBY_RELEASE_DATE: String
24
57
 
58
+ # <!-- rdoc-file=version.c -->
59
+ # The GIT commit hash for this ruby.
60
+ #
25
61
  ::RUBY_REVISION: Integer
26
62
 
63
+ # <!-- rdoc-file=version.c -->
64
+ # The running version of ruby
65
+ #
27
66
  ::RUBY_VERSION: String
28
67
 
68
+ # <!-- rdoc-file=io.c -->
69
+ # Holds the original stderr
70
+ #
29
71
  ::STDERR: IO
30
72
 
73
+ # <!-- rdoc-file=io.c -->
74
+ # Holds the original stdin
75
+ #
31
76
  ::STDIN: IO
32
77
 
78
+ # <!-- rdoc-file=io.c -->
79
+ # Holds the original stdout
80
+ #
33
81
  ::STDOUT: IO
34
82
 
83
+ # <!-- rdoc-file=vm.c -->
84
+ # The Binding of the top level scope
85
+ #
35
86
  ::TOPLEVEL_BINDING: Binding
36
87
 
37
88
  ::TRUE: TrueClass
data/core/deprecated.rbs CHANGED
@@ -1,2 +1,9 @@
1
+ # <!-- rdoc-file=numeric.c -->
2
+ # An obsolete class, use Integer
3
+ #
1
4
  Fixnum: singleton(Integer)
5
+
6
+ # <!-- rdoc-file=bignum.c -->
7
+ # An obsolete class, use Integer
8
+ #
2
9
  Bignum: singleton(Integer)