rbs 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/core/complex.rbs +290 -177
- data/core/dir.rbs +22 -9
- data/core/errors.rbs +1 -5
- data/core/file.rbs +152 -37
- data/core/float.rbs +4 -6
- data/core/gc.rbs +1 -0
- data/core/io/buffer.rbs +126 -47
- data/core/io.rbs +9 -0
- data/core/kernel.rbs +3 -3
- data/core/match_data.rbs +24 -14
- data/core/module.rbs +23 -18
- data/core/numeric.rbs +13 -16
- data/core/object_space/weak_key_map.rbs +78 -11
- data/core/object_space.rbs +2 -0
- data/core/process.rbs +4 -3
- data/core/range.rbs +10 -9
- data/core/refinement.rbs +10 -1
- data/core/string.rbs +24 -25
- data/core/thread.rbs +4 -4
- data/core/trace_point.rbs +7 -4
- data/lib/rbs/version.rb +1 -1
- data/stdlib/bigdecimal/0/big_decimal.rbs +28 -29
- data/stdlib/pty/0/pty.rbs +1 -7
- data/stdlib/socket/0/addrinfo.rbs +4 -0
- data/stdlib/socket/0/basic_socket.rbs +4 -2
- data/stdlib/socket/0/socket.rbs +4 -3
- data/stdlib/socket/0/udp_socket.rbs +4 -2
- metadata +3 -3
data/core/dir.rbs
CHANGED
@@ -221,7 +221,7 @@ class Dir
|
|
221
221
|
#
|
222
222
|
# * Calls the block with the argument.
|
223
223
|
# * Changes to the given directory.
|
224
|
-
# * Executes the block
|
224
|
+
# * Executes the block (yielding the new path).
|
225
225
|
# * Restores the previous working directory.
|
226
226
|
# * Returns the block's return value.
|
227
227
|
#
|
@@ -384,16 +384,14 @@ class Dir
|
|
384
384
|
# Dir.pwd # => "/var/spool/mail"
|
385
385
|
# dir = Dir.new('/usr')
|
386
386
|
# fd = dir.fileno
|
387
|
-
# Dir.fchdir(fd)
|
388
|
-
#
|
389
|
-
# end
|
390
|
-
# Dir.pwd # => "/var/spool/mail"
|
387
|
+
# Dir.fchdir(fd)
|
388
|
+
# Dir.pwd # => "/usr"
|
391
389
|
#
|
392
390
|
# With a block, temporarily changes the working directory:
|
393
391
|
#
|
394
392
|
# * Calls the block with the argument.
|
395
393
|
# * Changes to the given directory.
|
396
|
-
# * Executes the block
|
394
|
+
# * Executes the block (yields no args).
|
397
395
|
# * Restores the previous working directory.
|
398
396
|
# * Returns the block's return value.
|
399
397
|
#
|
@@ -402,7 +400,9 @@ class Dir
|
|
402
400
|
#
|
403
401
|
# Dir.chdir('/var/spool/mail')
|
404
402
|
# Dir.pwd # => "/var/spool/mail"
|
405
|
-
# Dir.
|
403
|
+
# dir = Dir.new('/tmp')
|
404
|
+
# fd = dir.fileno
|
405
|
+
# Dir.fchdir(fd) do
|
406
406
|
# Dir.pwd # => "/tmp"
|
407
407
|
# end
|
408
408
|
# Dir.pwd # => "/var/spool/mail"
|
@@ -763,15 +763,28 @@ class Dir
|
|
763
763
|
|
764
764
|
# <!--
|
765
765
|
# rdoc-file=dir.c
|
766
|
-
# - chdir ->
|
766
|
+
# - chdir -> 0
|
767
|
+
# - chdir { ... } -> object
|
767
768
|
# -->
|
768
|
-
# Changes the current working directory to
|
769
|
+
# Changes the current working directory to `self`:
|
769
770
|
#
|
770
771
|
# Dir.pwd # => "/"
|
771
772
|
# dir = Dir.new('example')
|
772
773
|
# dir.chdir
|
773
774
|
# Dir.pwd # => "/example"
|
774
775
|
#
|
776
|
+
# With a block, temporarily changes the working directory:
|
777
|
+
#
|
778
|
+
# * Calls the block.
|
779
|
+
# * Changes to the given directory.
|
780
|
+
# * Executes the block (yields no args).
|
781
|
+
# * Restores the previous working directory.
|
782
|
+
# * Returns the block's return value.
|
783
|
+
#
|
784
|
+
#
|
785
|
+
# Uses Dir.fchdir if available, and Dir.chdir if not, see those methods for
|
786
|
+
# caveats.
|
787
|
+
#
|
775
788
|
def chdir: () -> Integer
|
776
789
|
| [T] { () -> T } -> T
|
777
790
|
|
data/core/errors.rbs
CHANGED
@@ -188,10 +188,6 @@ end
|
|
188
188
|
#
|
189
189
|
# LoadError: no such file to load -- this/file/does/not/exist
|
190
190
|
#
|
191
|
-
# <!-- rdoc-file=lib/bundled_gems.rb -->
|
192
|
-
# for RubyGems without Bundler environment. If loading library is not part of
|
193
|
-
# the default gems and the bundled gems, warn it.
|
194
|
-
#
|
195
191
|
class LoadError < ScriptError
|
196
192
|
# <!-- rdoc-file=error.c -->
|
197
193
|
# the path failed to load
|
@@ -348,7 +344,7 @@ end
|
|
348
344
|
#
|
349
345
|
# *raises the exception:*
|
350
346
|
#
|
351
|
-
# NoMethodError: undefined method `to_ary' for
|
347
|
+
# NoMethodError: undefined method `to_ary' for an instance of String
|
352
348
|
#
|
353
349
|
class NoMethodError[T] < NameError[T]
|
354
350
|
# <!--
|
data/core/file.rbs
CHANGED
@@ -1836,43 +1836,64 @@ class File < IO
|
|
1836
1836
|
|
1837
1837
|
# <!--
|
1838
1838
|
# rdoc-file=file.c
|
1839
|
-
# -
|
1840
|
-
# -->
|
1841
|
-
# Locks or unlocks a file according to
|
1842
|
-
# values in the table below
|
1843
|
-
#
|
1844
|
-
#
|
1845
|
-
#
|
1846
|
-
#
|
1847
|
-
#
|
1848
|
-
#
|
1849
|
-
#
|
1850
|
-
#
|
1851
|
-
#
|
1852
|
-
#
|
1853
|
-
#
|
1854
|
-
#
|
1855
|
-
#
|
1856
|
-
#
|
1857
|
-
#
|
1858
|
-
#
|
1859
|
-
#
|
1860
|
-
#
|
1861
|
-
#
|
1862
|
-
#
|
1863
|
-
#
|
1864
|
-
#
|
1865
|
-
#
|
1866
|
-
#
|
1867
|
-
#
|
1868
|
-
#
|
1869
|
-
#
|
1870
|
-
#
|
1871
|
-
#
|
1872
|
-
#
|
1873
|
-
#
|
1874
|
-
#
|
1875
|
-
#
|
1839
|
+
# - flock(locking_constant) -> 0 or false
|
1840
|
+
# -->
|
1841
|
+
# Locks or unlocks a file according to the given `locking_constant`,
|
1842
|
+
# a bitwise OR of the values in the table below.
|
1843
|
+
# Not available on all platforms.
|
1844
|
+
# Returns `false` if `File::LOCK_NB` is specified and the operation would have
|
1845
|
+
# blocked;
|
1846
|
+
# otherwise returns `0`.
|
1847
|
+
#
|
1848
|
+
# <table>
|
1849
|
+
# <tr>
|
1850
|
+
# <th colspan="3">Locking Constants</th>
|
1851
|
+
# </tr>
|
1852
|
+
# <tr>
|
1853
|
+
# <th>Constant</th>
|
1854
|
+
# <th>Lock</th>
|
1855
|
+
# <th>Effect</th>
|
1856
|
+
# </tr>
|
1857
|
+
# <tr>
|
1858
|
+
# <td><tt>File::LOCK_EX</tt></td>
|
1859
|
+
# <td>Exclusive</td>
|
1860
|
+
# <td>Only one process may hold an exclusive lock for <tt>self</tt> at a time.</td>
|
1861
|
+
# </tr>
|
1862
|
+
# <tr>
|
1863
|
+
# <td><tt>File::LOCK_NB</tt></td>
|
1864
|
+
# <td>Non-blocking</td>
|
1865
|
+
# <td>
|
1866
|
+
# No blocking; may be combined with other <tt>File::LOCK_SH</tt> or <tt>File::LOCK_EX</tt>
|
1867
|
+
# using the bitwise OR operator <tt>|</tt>.
|
1868
|
+
# </td>
|
1869
|
+
# </tr>
|
1870
|
+
# <tr>
|
1871
|
+
# <td><tt>File::LOCK_SH</tt></td>
|
1872
|
+
# <td>Shared</td>
|
1873
|
+
# <td>Multiple processes may each hold a shared lock for <tt>self</tt> at the same time.</td>
|
1874
|
+
# </tr>
|
1875
|
+
# <tr>
|
1876
|
+
# <td><tt>File::LOCK_UN</tt></td>
|
1877
|
+
# <td>Unlock</td>
|
1878
|
+
# <td>Remove an existing lock held by this process.</td>
|
1879
|
+
# </tr>
|
1880
|
+
# </table>
|
1881
|
+
# # Update a counter using an exclusive lock.
|
1882
|
+
# # Don't use File::WRONLY because it truncates the file.
|
1883
|
+
# File.open('counter', File::RDWR | File::CREAT, 0644) do |f|
|
1884
|
+
# f.flock(File::LOCK_EX)
|
1885
|
+
# value = f.read.to_i + 1
|
1886
|
+
# f.rewind
|
1887
|
+
# f.write("#{value}\n")
|
1888
|
+
# f.flush
|
1889
|
+
# f.truncate(f.pos)
|
1890
|
+
# end
|
1891
|
+
#
|
1892
|
+
# # Read the counter using a shared lock.
|
1893
|
+
# File.open('counter', 'r') do |f|
|
1894
|
+
# f.flock(File::LOCK_SH)
|
1895
|
+
# f.read
|
1896
|
+
# end
|
1876
1897
|
#
|
1877
1898
|
def flock: (int locking_constant) -> (0 | false)
|
1878
1899
|
|
@@ -2292,64 +2313,158 @@ File::Separator: String
|
|
2292
2313
|
module File::Constants
|
2293
2314
|
end
|
2294
2315
|
|
2316
|
+
# <!-- rdoc-file=file.c -->
|
2317
|
+
# [File::APPEND](rdoc-ref:File::Constants@File-3A-3AAPPEND)
|
2318
|
+
#
|
2295
2319
|
File::Constants::APPEND: Integer
|
2296
2320
|
|
2321
|
+
# <!-- rdoc-file=file.c -->
|
2322
|
+
# [File::BINARY](rdoc-ref:File::Constants@File-3A-3ABINARY)
|
2323
|
+
#
|
2297
2324
|
File::Constants::BINARY: Integer
|
2298
2325
|
|
2326
|
+
# <!-- rdoc-file=file.c -->
|
2327
|
+
# [File::CREAT](rdoc-ref:File::Constants@File-3A-3ACREAT)
|
2328
|
+
#
|
2299
2329
|
File::Constants::CREAT: Integer
|
2300
2330
|
|
2331
|
+
# <!-- rdoc-file=file.c -->
|
2332
|
+
# [File::DIRECT](rdoc-ref:File::Constants@File-3A-3ADIRECT)
|
2333
|
+
#
|
2301
2334
|
File::Constants::DIRECT: Integer
|
2302
2335
|
|
2336
|
+
# <!-- rdoc-file=file.c -->
|
2337
|
+
# [File::DSYNC](rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+an
|
2338
|
+
# d+File-3A-3ADSYNC)
|
2339
|
+
#
|
2303
2340
|
File::Constants::DSYNC: Integer
|
2304
2341
|
|
2342
|
+
# <!-- rdoc-file=file.c -->
|
2343
|
+
# [File::EXCL](rdoc-ref:File::Constants@File-3A-3AEXCL)
|
2344
|
+
#
|
2305
2345
|
File::Constants::EXCL: Integer
|
2306
2346
|
|
2347
|
+
# <!-- rdoc-file=dir.c -->
|
2348
|
+
# [File::FNM_CASEFOLD](rdoc-ref:File::Constants@File-3A-3AFNM_CASEFOLD)
|
2349
|
+
#
|
2307
2350
|
File::Constants::FNM_CASEFOLD: Integer
|
2308
2351
|
|
2352
|
+
# <!-- rdoc-file=dir.c -->
|
2353
|
+
# [File::FNM_DOTMATCH](rdoc-ref:File::Constants@File-3A-3AFNM_DOTMATCH)
|
2354
|
+
#
|
2309
2355
|
File::Constants::FNM_DOTMATCH: Integer
|
2310
2356
|
|
2357
|
+
# <!-- rdoc-file=dir.c -->
|
2358
|
+
# [File::FNM_EXTGLOB](rdoc-ref:File::Constants@File-3A-3AFNM_EXTGLOB)
|
2359
|
+
#
|
2311
2360
|
File::Constants::FNM_EXTGLOB: Integer
|
2312
2361
|
|
2362
|
+
# <!-- rdoc-file=dir.c -->
|
2363
|
+
# [File::FNM_NOESCAPE](rdoc-ref:File::Constants@File-3A-3AFNM_NOESCAPE)
|
2364
|
+
#
|
2313
2365
|
File::Constants::FNM_NOESCAPE: Integer
|
2314
2366
|
|
2367
|
+
# <!-- rdoc-file=dir.c -->
|
2368
|
+
# [File::FNM_PATHNAME](rdoc-ref:File::Constants@File-3A-3AFNM_PATHNAME)
|
2369
|
+
#
|
2315
2370
|
File::Constants::FNM_PATHNAME: Integer
|
2316
2371
|
|
2372
|
+
# <!-- rdoc-file=dir.c -->
|
2373
|
+
# [File::FNM_SHORTNAME](rdoc-ref:File::Constants@File-3A-3AFNM_SHORTNAME)
|
2374
|
+
#
|
2317
2375
|
File::Constants::FNM_SHORTNAME: Integer
|
2318
2376
|
|
2377
|
+
# <!-- rdoc-file=dir.c -->
|
2378
|
+
# [File::FNM_SYSCASE](rdoc-ref:File::Constants@File-3A-3AFNM_SYSCASE)
|
2379
|
+
#
|
2319
2380
|
File::Constants::FNM_SYSCASE: Integer
|
2320
2381
|
|
2382
|
+
# <!-- rdoc-file=file.c -->
|
2383
|
+
# [File::LOCK_EX](rdoc-ref:File::Constants@File-3A-3ALOCK_EX)
|
2384
|
+
#
|
2321
2385
|
File::Constants::LOCK_EX: Integer
|
2322
2386
|
|
2387
|
+
# <!-- rdoc-file=file.c -->
|
2388
|
+
# [File::LOCK_NB](rdoc-ref:File::Constants@File-3A-3ALOCK_NB)
|
2389
|
+
#
|
2323
2390
|
File::Constants::LOCK_NB: Integer
|
2324
2391
|
|
2392
|
+
# <!-- rdoc-file=file.c -->
|
2393
|
+
# [File::LOCK_SH](rdoc-ref:File::Constants@File-3A-3ALOCK_SH)
|
2394
|
+
#
|
2325
2395
|
File::Constants::LOCK_SH: Integer
|
2326
2396
|
|
2397
|
+
# <!-- rdoc-file=file.c -->
|
2398
|
+
# [File::LOCK_UN](rdoc-ref:File::Constants@File-3A-3ALOCK_UN)
|
2399
|
+
#
|
2327
2400
|
File::Constants::LOCK_UN: Integer
|
2328
2401
|
|
2402
|
+
# <!-- rdoc-file=file.c -->
|
2403
|
+
# [File::NOATIME](rdoc-ref:File::Constants@File-3A-3ANOATIME)
|
2404
|
+
#
|
2329
2405
|
File::Constants::NOATIME: Integer
|
2330
2406
|
|
2407
|
+
# <!-- rdoc-file=file.c -->
|
2408
|
+
# [File::NOCTTY](rdoc-ref:File::Constants@File-3A-3ANOCTTY)
|
2409
|
+
#
|
2331
2410
|
File::Constants::NOCTTY: Integer
|
2332
2411
|
|
2412
|
+
# <!-- rdoc-file=file.c -->
|
2413
|
+
# [File::NOFOLLOW](rdoc-ref:File::Constants@File-3A-3ANOFOLLOW)
|
2414
|
+
#
|
2333
2415
|
File::Constants::NOFOLLOW: Integer
|
2334
2416
|
|
2417
|
+
# <!-- rdoc-file=file.c -->
|
2418
|
+
# [File::NONBLOCK](rdoc-ref:File::Constants@File-3A-3ANONBLOCK)
|
2419
|
+
#
|
2335
2420
|
File::Constants::NONBLOCK: Integer
|
2336
2421
|
|
2422
|
+
# <!-- rdoc-file=file.c -->
|
2423
|
+
# [File::NULL](rdoc-ref:File::Constants@File-3A-3ANULL)
|
2424
|
+
#
|
2337
2425
|
File::Constants::NULL: String
|
2338
2426
|
|
2427
|
+
# <!-- rdoc-file=file.c -->
|
2428
|
+
# [File::RDONLY](rdoc-ref:File::Constants@File-3A-3ARDONLY)
|
2429
|
+
#
|
2339
2430
|
File::Constants::RDONLY: Integer
|
2340
2431
|
|
2432
|
+
# <!-- rdoc-file=file.c -->
|
2433
|
+
# [File::RDWR](rdoc-ref:File::Constants@File-3A-3ARDWR)
|
2434
|
+
#
|
2341
2435
|
File::Constants::RDWR: Integer
|
2342
2436
|
|
2437
|
+
# <!-- rdoc-file=file.c -->
|
2438
|
+
# [File::RSYNC](rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+an
|
2439
|
+
# d+File-3A-3ADSYNC)
|
2440
|
+
#
|
2343
2441
|
File::Constants::RSYNC: Integer
|
2344
2442
|
|
2443
|
+
# <!-- rdoc-file=file.c -->
|
2444
|
+
# [File::SHARE_DELETE](rdoc-ref:File::Constants@File-3A-3ASHARE_DELETE+-28Window
|
2445
|
+
# s+Only-29)
|
2446
|
+
#
|
2345
2447
|
File::Constants::SHARE_DELETE: Integer
|
2346
2448
|
|
2449
|
+
# <!-- rdoc-file=file.c -->
|
2450
|
+
# [File::SYNC](rdoc-ref:File::Constants@File-3A-3ASYNC-2C+File-3A-3ARSYNC-2C+and
|
2451
|
+
# +File-3A-3ADSYNC)
|
2452
|
+
#
|
2347
2453
|
File::Constants::SYNC: Integer
|
2348
2454
|
|
2455
|
+
# <!-- rdoc-file=file.c -->
|
2456
|
+
# [File::TMPFILE](rdoc-ref:File::Constants@File-3A-3ATMPFILE)
|
2457
|
+
#
|
2349
2458
|
File::Constants::TMPFILE: Integer
|
2350
2459
|
|
2460
|
+
# <!-- rdoc-file=file.c -->
|
2461
|
+
# [File::TRUNC](rdoc-ref:File::Constants@File-3A-3ATRUNC)
|
2462
|
+
#
|
2351
2463
|
File::Constants::TRUNC: Integer
|
2352
2464
|
|
2465
|
+
# <!-- rdoc-file=file.c -->
|
2466
|
+
# [File::WRONLY](rdoc-ref:File::Constants@File-3A-3AWRONLY)
|
2467
|
+
#
|
2353
2468
|
File::Constants::WRONLY: Integer
|
2354
2469
|
|
2355
2470
|
# <!-- rdoc-file=file.c -->
|
data/core/float.rbs
CHANGED
@@ -337,17 +337,15 @@ class Float < Numeric
|
|
337
337
|
def abs2: () -> Float
|
338
338
|
|
339
339
|
# <!-- rdoc-file=complex.c -->
|
340
|
-
# Returns 0 if
|
340
|
+
# Returns 0 if `self` is positive, Math::PI otherwise.
|
341
341
|
#
|
342
342
|
def angle: () -> (Integer | Float)
|
343
343
|
|
344
344
|
# <!--
|
345
345
|
# rdoc-file=complex.c
|
346
|
-
# -
|
347
|
-
# - flo.angle -> 0 or float
|
348
|
-
# - flo.phase -> 0 or float
|
346
|
+
# - arg -> 0 or Math::PI
|
349
347
|
# -->
|
350
|
-
# Returns 0 if
|
348
|
+
# Returns 0 if `self` is positive, Math::PI otherwise.
|
351
349
|
#
|
352
350
|
alias arg angle
|
353
351
|
|
@@ -708,7 +706,7 @@ class Float < Numeric
|
|
708
706
|
def numerator: () -> Integer
|
709
707
|
|
710
708
|
# <!-- rdoc-file=complex.c -->
|
711
|
-
# Returns 0 if
|
709
|
+
# Returns 0 if `self` is positive, Math::PI otherwise.
|
712
710
|
#
|
713
711
|
alias phase angle
|
714
712
|
|
data/core/gc.rbs
CHANGED
@@ -259,6 +259,7 @@ module GC
|
|
259
259
|
# rdoc-file=gc.rb
|
260
260
|
# - garbage_collect(full_mark: true, immediate_mark: true, immediate_sweep: true)
|
261
261
|
# -->
|
262
|
+
# Alias of GC.start
|
262
263
|
#
|
263
264
|
def garbage_collect: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
|
264
265
|
end
|