rbs 3.8.0.pre.1 → 3.8.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 +3 -3
- data/.github/workflows/ruby.yml +7 -7
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +30 -0
- data/core/array.rbs +64 -62
- data/core/complex.rbs +1 -1
- data/core/encoding.rbs +0 -26
- data/core/errors.rbs +4 -0
- data/core/exception.rbs +149 -40
- data/core/file.rbs +1 -8
- data/core/gc.rbs +21 -3
- data/core/hash.rbs +2 -2
- data/core/io.rbs +2 -2
- data/core/kernel.rbs +58 -16
- data/core/nil_class.rbs +3 -0
- data/core/numeric.rbs +1 -1
- data/core/proc.rbs +80 -10
- data/core/ractor.rbs +20 -0
- data/core/regexp.rbs +6 -4
- data/core/ruby_vm.rbs +9 -9
- data/core/rubygems/errors.rbs +3 -1
- data/core/rubygems/rubygems.rbs +3 -1
- data/core/string.rbs +132 -130
- data/core/time.rbs +5 -1
- data/core/trace_point.rbs +108 -113
- data/ext/rbs_extension/parser.c +1 -1
- data/lib/rbs/types.rb +2 -1
- data/lib/rbs/version.rb +1 -1
- data/stdlib/date/0/date.rbs +23 -23
- data/stdlib/monitor/0/monitor.rbs +13 -4
- data/stdlib/net-http/0/net-http.rbs +20 -29
- data/stdlib/rdoc/0/rdoc.rbs +12 -6
- data/stdlib/resolv/0/resolv.rbs +5 -1
- data/stdlib/securerandom/0/securerandom.rbs +7 -0
- data/stdlib/socket/0/socket.rbs +9 -28
- data/stdlib/socket/0/tcp_socket.rbs +8 -30
- data/stdlib/tmpdir/0/tmpdir.rbs +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a48774543c23555bbcb9c6a13b387db3069fe4c65d534a7915798e85d37fa770
|
4
|
+
data.tar.gz: 034e53e2be22a3ca9ac15b8f95585c8fe42bf2267268f1eb23cffe2e92098213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31c29db0f7d38c22d3ab9c3ee5df5403bba9b489b38211fdd824b76f948e89efafd4b2e3afe81ec9420b3a76c350daccb5b23dddd57d85199a93531fd28e73b3
|
7
|
+
data.tar.gz: d8077101a4f4f26073d047ad4c7b04752f7e1849a1b3bdcfc41703e82b6b109d68e8c295ed2a0af57fc5e5744600ad89b77f24b1b93fbee226b42bd5d86493ee
|
@@ -10,13 +10,13 @@ on:
|
|
10
10
|
jobs:
|
11
11
|
comments:
|
12
12
|
runs-on: "ubuntu-latest"
|
13
|
-
env:
|
14
|
-
|
13
|
+
# env:
|
14
|
+
# RUBY_COMMIT: 1b0c46daed9186b82ab4fef1a4ab225afe582ee6
|
15
15
|
steps:
|
16
16
|
- uses: actions/checkout@v4
|
17
17
|
- uses: ruby/setup-ruby@v1
|
18
18
|
with:
|
19
|
-
ruby-version: "3.4.
|
19
|
+
ruby-version: "3.4.1"
|
20
20
|
bundler: none
|
21
21
|
- name: Install dependencies
|
22
22
|
run: |
|
data/.github/workflows/ruby.yml
CHANGED
@@ -13,26 +13,26 @@ jobs:
|
|
13
13
|
strategy:
|
14
14
|
fail-fast: false
|
15
15
|
matrix:
|
16
|
-
ruby: ['3.1', '3.2', '3.3', '3.4
|
16
|
+
ruby: ['3.1', '3.2', '3.3', '3.4', head]
|
17
17
|
rubyopt: [""]
|
18
18
|
job:
|
19
19
|
- test
|
20
20
|
include:
|
21
21
|
- ruby: head
|
22
22
|
job: stdlib_test rubocop
|
23
|
-
- ruby: "3.4
|
23
|
+
- ruby: "3.4"
|
24
24
|
job: stdlib_test
|
25
|
-
- ruby: "3.4
|
25
|
+
- ruby: "3.4"
|
26
26
|
job: test
|
27
27
|
rubyopt: "--enable-frozen-string-literal"
|
28
|
-
- ruby: "3.4
|
28
|
+
- ruby: "3.4"
|
29
29
|
job: stdlib_test
|
30
30
|
rubyopt: "--enable-frozen-string-literal"
|
31
|
-
- ruby: "3.4
|
31
|
+
- ruby: "3.4"
|
32
32
|
job: lexer templates compile confirm_lexer confirm_templates
|
33
|
-
- ruby: "3.4
|
33
|
+
- ruby: "3.4"
|
34
34
|
job: rubocop validate test_doc build test_generate_stdlib raap
|
35
|
-
- ruby: "3.4
|
35
|
+
- ruby: "3.4"
|
36
36
|
job: typecheck_test
|
37
37
|
env:
|
38
38
|
RANDOMIZE_STDLIB_TEST_ORDER: "true"
|
data/.rubocop.yml
CHANGED
@@ -15,6 +15,7 @@ Rubycw/Rubycw:
|
|
15
15
|
|
16
16
|
RBS:
|
17
17
|
Enabled: true
|
18
|
+
|
18
19
|
RBS/Layout:
|
19
20
|
Enabled: true
|
20
21
|
Exclude:
|
@@ -23,6 +24,7 @@ RBS/Layout:
|
|
23
24
|
RBS/Layout/CommentIndentation:
|
24
25
|
Exclude:
|
25
26
|
- core/string.rbs
|
27
|
+
|
26
28
|
RBS/Lint:
|
27
29
|
Enabled: true
|
28
30
|
Exclude:
|
@@ -32,6 +34,11 @@ RBS/Lint/TopLevelInterface:
|
|
32
34
|
Enabled: false
|
33
35
|
RBS/Lint/TopLevelTypeAlias:
|
34
36
|
Enabled: false
|
37
|
+
RBS/Lint/AmbiguousKeywordArgumentKey:
|
38
|
+
Exclude:
|
39
|
+
# OpenSSL::KDF.scrypt
|
40
|
+
- 'stdlib/openssl/0/openssl.rbs'
|
41
|
+
|
35
42
|
RBS/Style:
|
36
43
|
Enabled: false
|
37
44
|
Exclude:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.8.1 (2024-12-27)
|
4
|
+
|
5
|
+
### Signature updates
|
6
|
+
|
7
|
+
* `Ractor.store_if_absent` ([#2206](https://github.com/ruby/rbs/pull/2206))
|
8
|
+
* `Time#iso860t1` ([#2207](https://github.com/ruby/rbs/pull/2207))
|
9
|
+
* `Time#xmlschema` ([#2207](https://github.com/ruby/rbs/pull/2207))
|
10
|
+
|
11
|
+
### Miscellaneous
|
12
|
+
|
13
|
+
* Update rubocop-on-rbs ([#2200](https://github.com/ruby/rbs/pull/2200))
|
14
|
+
* Update docs based on Ruby 3.4.1 ([#2208](https://github.com/ruby/rbs/pull/2208))
|
15
|
+
* Ruby 3.4.1 ([#2206](https://github.com/ruby/rbs/pull/2206))
|
16
|
+
|
17
|
+
## 3.8.0 (2024-12-24)
|
18
|
+
|
19
|
+
### Signature updates
|
20
|
+
|
21
|
+
* `Dir.mktmpdir` ([#2158](https://github.com/ruby/rbs/pull/2158))
|
22
|
+
* `File.join` ([#2158](https://github.com/ruby/rbs/pull/2158))
|
23
|
+
* `IO#each_line` ([#2151](https://github.com/ruby/rbs/pull/2151))
|
24
|
+
* `Kernel#readlines` ([#2151](https://github.com/ruby/rbs/pull/2151))
|
25
|
+
* `Ractor.store_if_absent` ([#2198](https://github.com/ruby/rbs/pull/2198))
|
26
|
+
* Update docs as of 2024-12-24, 16:13 JST ([#2193](https://github.com/ruby/rbs/pull/2193))
|
27
|
+
|
28
|
+
### Library changes
|
29
|
+
|
30
|
+
* Adjust capacity of location children ([#2197](https://github.com/ruby/rbs/pull/2197))
|
31
|
+
* Should validate self-type on Proc ([#2192](https://github.com/ruby/rbs/pull/2192))
|
32
|
+
|
3
33
|
## 3.8.0.pre.1 (2024-12-19)
|
4
34
|
|
5
35
|
### Signature updates
|
data/core/array.rbs
CHANGED
@@ -70,18 +70,20 @@
|
|
70
70
|
#
|
71
71
|
# You can create an Array object explicitly with:
|
72
72
|
#
|
73
|
-
# * An [array literal](rdoc-ref:literals.rdoc@Array+Literals):
|
73
|
+
# * An [array literal](rdoc-ref:syntax/literals.rdoc@Array+Literals):
|
74
74
|
#
|
75
75
|
# [1, 'one', :one, [2, 'two', :two]]
|
76
76
|
#
|
77
|
-
# * A [%w or %W
|
78
|
-
# Literal](rdoc-ref:literals.rdoc@25w+and+-25W-3A+String-Array+
|
77
|
+
# * A [%w or %W string-array
|
78
|
+
# Literal](rdoc-ref:syntax/literals.rdoc@25w+and+-25W-3A+String-Array+Litera
|
79
|
+
# ls):
|
79
80
|
#
|
80
81
|
# %w[foo bar baz] # => ["foo", "bar", "baz"]
|
81
82
|
# %w[1 % *] # => ["1", "%", "*"]
|
82
83
|
#
|
83
|
-
# * A [%i
|
84
|
-
# Literal](rdoc-ref:literals.rdoc@25i+and+-25I-3A+Symbol-Array+
|
84
|
+
# * A [%i or %I symbol-array
|
85
|
+
# Literal](rdoc-ref:syntax/literals.rdoc@25i+and+-25I-3A+Symbol-Array+Litera
|
86
|
+
# ls):
|
85
87
|
#
|
86
88
|
# %i[foo bar baz] # => [:foo, :bar, :baz]
|
87
89
|
# %i[1 % *] # => [:"1", :%, :*]
|
@@ -677,7 +679,7 @@ class Array[unchecked out Elem] < Object
|
|
677
679
|
# When string argument `string_separator` is given, equivalent to
|
678
680
|
# `self.join(string_separator)`:
|
679
681
|
#
|
680
|
-
# [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {:
|
682
|
+
# [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {foo: 0}"
|
681
683
|
#
|
682
684
|
def *: (string str) -> ::String
|
683
685
|
| (int int) -> ::Array[Elem]
|
@@ -1293,13 +1295,13 @@ class Array[unchecked out Elem] < Object
|
|
1293
1295
|
|
1294
1296
|
# <!--
|
1295
1297
|
# rdoc-file=array.c
|
1296
|
-
# - combination(
|
1297
|
-
# - combination(
|
1298
|
+
# - combination(count) {|element| ... } -> self
|
1299
|
+
# - combination(count) -> new_enumerator
|
1298
1300
|
# -->
|
1299
1301
|
# When a block and a positive [integer-convertible
|
1300
1302
|
# object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects)
|
1301
|
-
# argument `
|
1302
|
-
#
|
1303
|
+
# argument `count` (`0 < count <= self.size`) are given, calls the block with
|
1304
|
+
# each combination of `self` of size `count`; returns `self`:
|
1303
1305
|
#
|
1304
1306
|
# a = %w[a b c] # => ["a", "b", "c"]
|
1305
1307
|
# a.combination(2) {|combination| p combination } # => ["a", "b", "c"]
|
@@ -1312,7 +1314,7 @@ class Array[unchecked out Elem] < Object
|
|
1312
1314
|
#
|
1313
1315
|
# The order of the yielded combinations is not guaranteed.
|
1314
1316
|
#
|
1315
|
-
# When `
|
1317
|
+
# When `count` is zero, calls the block once with a new empty array:
|
1316
1318
|
#
|
1317
1319
|
# a.combination(0) {|combination| p combination }
|
1318
1320
|
# [].combination(0) {|combination| p combination }
|
@@ -1322,8 +1324,8 @@ class Array[unchecked out Elem] < Object
|
|
1322
1324
|
# []
|
1323
1325
|
# []
|
1324
1326
|
#
|
1325
|
-
# When `
|
1326
|
-
# not call the block:
|
1327
|
+
# When `count` is negative or larger than `self.size` and `self` is non-empty,
|
1328
|
+
# does not call the block:
|
1327
1329
|
#
|
1328
1330
|
# a.combination(-1) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
|
1329
1331
|
# a.combination(4) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
|
@@ -1583,10 +1585,10 @@ class Array[unchecked out Elem] < Object
|
|
1583
1585
|
|
1584
1586
|
# <!--
|
1585
1587
|
# rdoc-file=array.c
|
1586
|
-
# - drop(
|
1588
|
+
# - drop(count) -> new_array
|
1587
1589
|
# -->
|
1588
|
-
# Returns a new array containing all but the first `
|
1589
|
-
# `
|
1590
|
+
# Returns a new array containing all but the first `count` element of `self`,
|
1591
|
+
# where `count` is a non-negative integer; does not modify `self`.
|
1590
1592
|
#
|
1591
1593
|
# Examples:
|
1592
1594
|
#
|
@@ -1766,34 +1768,34 @@ class Array[unchecked out Elem] < Object
|
|
1766
1768
|
# <!--
|
1767
1769
|
# rdoc-file=array.rb
|
1768
1770
|
# - fetch_values(*indexes) -> new_array
|
1769
|
-
# - fetch_values(*indexes) {|index| ... } -> new_array
|
1771
|
+
# - fetch_values(*indexes) { |index| ... } -> new_array
|
1770
1772
|
# -->
|
1771
1773
|
# With no block given, returns a new array containing the elements of `self` at
|
1772
|
-
# the offsets
|
1774
|
+
# the offsets specified by `indexes`. Each of the `indexes` must be an
|
1773
1775
|
# [integer-convertible
|
1774
1776
|
# object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects):
|
1775
1777
|
#
|
1776
1778
|
# a = [:foo, :bar, :baz]
|
1777
|
-
# a.fetch_values(
|
1778
|
-
# a.fetch_values(
|
1779
|
+
# a.fetch_values(2, 0) # => [:baz, :foo]
|
1780
|
+
# a.fetch_values(2.1, 0) # => [:baz, :foo]
|
1779
1781
|
# a.fetch_values # => []
|
1780
1782
|
#
|
1781
1783
|
# For a negative index, counts backwards from the end of the array:
|
1782
1784
|
#
|
1783
|
-
# a.fetch_values(
|
1785
|
+
# a.fetch_values(-2, -1) # [:bar, :baz]
|
1784
1786
|
#
|
1785
1787
|
# When no block is given, raises an exception if any index is out of range.
|
1786
1788
|
#
|
1787
1789
|
# With a block given, for each index:
|
1788
1790
|
#
|
1789
|
-
# * If the index
|
1790
|
-
# * Otherwise calls
|
1791
|
+
# * If the index is in range, uses an element of `self` (as above).
|
1792
|
+
# * Otherwise, calls the block with the index and uses the block's return
|
1791
1793
|
# value.
|
1792
1794
|
#
|
1793
1795
|
# Example:
|
1794
1796
|
#
|
1795
1797
|
# a = [:foo, :bar, :baz]
|
1796
|
-
# a.fetch_values(1, 0, 42, 777) {|index| index.to_s}
|
1798
|
+
# a.fetch_values(1, 0, 42, 777) { |index| index.to_s }
|
1797
1799
|
# # => [:bar, :foo, "42", "777"]
|
1798
1800
|
#
|
1799
1801
|
# Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
|
@@ -2070,7 +2072,7 @@ class Array[unchecked out Elem] < Object
|
|
2070
2072
|
#
|
2071
2073
|
# [].first # => nil
|
2072
2074
|
#
|
2073
|
-
# With non-negative integer argument `count` given, returns the first `count`
|
2075
|
+
# With a non-negative integer argument `count` given, returns the first `count`
|
2074
2076
|
# elements (as available) in a new array:
|
2075
2077
|
#
|
2076
2078
|
# a.first(0) # => []
|
@@ -2348,7 +2350,7 @@ class Array[unchecked out Elem] < Object
|
|
2348
2350
|
# <!--
|
2349
2351
|
# rdoc-file=array.rb
|
2350
2352
|
# - last -> last_object or nil
|
2351
|
-
# - last(
|
2353
|
+
# - last(count) -> new_array
|
2352
2354
|
# -->
|
2353
2355
|
# Returns elements from `self`, or `nil`; `self` is not modified.
|
2354
2356
|
#
|
@@ -2359,8 +2361,8 @@ class Array[unchecked out Elem] < Object
|
|
2359
2361
|
# a # => [:foo, "bar", 2]
|
2360
2362
|
# [].last # => nil
|
2361
2363
|
#
|
2362
|
-
# With non-negative integer argument `
|
2363
|
-
# containing the trailing `
|
2364
|
+
# With non-negative integer argument `count` given, returns a new array
|
2365
|
+
# containing the trailing `count` elements of `self`, as available:
|
2364
2366
|
#
|
2365
2367
|
# a = [:foo, 'bar', 2]
|
2366
2368
|
# a.last(2) # => ["bar", 2]
|
@@ -2419,9 +2421,9 @@ class Array[unchecked out Elem] < Object
|
|
2419
2421
|
# <!--
|
2420
2422
|
# rdoc-file=array.c
|
2421
2423
|
# - max -> element
|
2422
|
-
# - max(
|
2424
|
+
# - max(count) -> new_array
|
2423
2425
|
# - max {|a, b| ... } -> element
|
2424
|
-
# - max(
|
2426
|
+
# - max(count) {|a, b| ... } -> new_array
|
2425
2427
|
# -->
|
2426
2428
|
# Returns one of the following:
|
2427
2429
|
#
|
@@ -2438,8 +2440,8 @@ class Array[unchecked out Elem] < Object
|
|
2438
2440
|
#
|
2439
2441
|
# [1, 0, 3, 2].max # => 3
|
2440
2442
|
#
|
2441
|
-
# With non-negative numeric argument `
|
2442
|
-
# at most `
|
2443
|
+
# With non-negative numeric argument `count` and no block, returns a new array
|
2444
|
+
# with at most `count` elements, in descending order, per method `#<=>`:
|
2443
2445
|
#
|
2444
2446
|
# [1, 0, 3, 2].max(3) # => [3, 2, 1]
|
2445
2447
|
# [1, 0, 3, 2].max(3.0) # => [3, 2, 1]
|
@@ -2454,8 +2456,8 @@ class Array[unchecked out Elem] < Object
|
|
2454
2456
|
# ['0', '', '000', '00'].max {|a, b| a.size <=> b.size }
|
2455
2457
|
# # => "000"
|
2456
2458
|
#
|
2457
|
-
# With non-negative numeric argument `
|
2458
|
-
# at most `
|
2459
|
+
# With non-negative numeric argument `count` and a block, returns a new array
|
2460
|
+
# with at most `count` elements, in descending order, per the block:
|
2459
2461
|
#
|
2460
2462
|
# ['0', '', '000', '00'].max(2) {|a, b| a.size <=> b.size }
|
2461
2463
|
# # => ["000", "00"]
|
@@ -2470,9 +2472,9 @@ class Array[unchecked out Elem] < Object
|
|
2470
2472
|
# <!--
|
2471
2473
|
# rdoc-file=array.c
|
2472
2474
|
# - min -> element
|
2473
|
-
# - min(
|
2475
|
+
# - min(count) -> new_array
|
2474
2476
|
# - min {|a, b| ... } -> element
|
2475
|
-
# - min(
|
2477
|
+
# - min(count) {|a, b| ... } -> new_array
|
2476
2478
|
# -->
|
2477
2479
|
# Returns one of the following:
|
2478
2480
|
#
|
@@ -2489,8 +2491,8 @@ class Array[unchecked out Elem] < Object
|
|
2489
2491
|
#
|
2490
2492
|
# [1, 0, 3, 2].min # => 0
|
2491
2493
|
#
|
2492
|
-
# With non-negative numeric argument `
|
2493
|
-
# at most `
|
2494
|
+
# With non-negative numeric argument `count` and no block, returns a new array
|
2495
|
+
# with at most `count` elements, in ascending order, per method `#<=>`:
|
2494
2496
|
#
|
2495
2497
|
# [1, 0, 3, 2].min(3) # => [0, 1, 2]
|
2496
2498
|
# [1, 0, 3, 2].min(3.0) # => [0, 1, 2]
|
@@ -2505,8 +2507,8 @@ class Array[unchecked out Elem] < Object
|
|
2505
2507
|
# ['0', '', '000', '00'].min {|a, b| a.size <=> b.size }
|
2506
2508
|
# # => ""
|
2507
2509
|
#
|
2508
|
-
# With non-negative numeric argument `
|
2509
|
-
# at most `
|
2510
|
+
# With non-negative numeric argument `count` and a block, returns a new array
|
2511
|
+
# with at most `count` elements, in ascending order, per the block:
|
2510
2512
|
#
|
2511
2513
|
# ['0', '', '000', '00'].min(2) {|a, b| a.size <=> b.size }
|
2512
2514
|
# # => ["", "0"]
|
@@ -2623,15 +2625,15 @@ class Array[unchecked out Elem] < Object
|
|
2623
2625
|
|
2624
2626
|
# <!--
|
2625
2627
|
# rdoc-file=array.c
|
2626
|
-
# - permutation(
|
2627
|
-
# - permutation(
|
2628
|
+
# - permutation(count = self.size) {|permutation| ... } -> self
|
2629
|
+
# - permutation(count = self.size) -> new_enumerator
|
2628
2630
|
# -->
|
2629
2631
|
# Iterates over permutations of the elements of `self`; the order of
|
2630
2632
|
# permutations is indeterminate.
|
2631
2633
|
#
|
2632
|
-
# With a block and an in-range positive integer argument `
|
2633
|
-
# self.size`) given, calls the block with each
|
2634
|
-
# returns `self`:
|
2634
|
+
# With a block and an in-range positive integer argument `count` (`0 < count <=
|
2635
|
+
# self.size`) given, calls the block with each permutation of `self` of size
|
2636
|
+
# `count`; returns `self`:
|
2635
2637
|
#
|
2636
2638
|
# a = [0, 1, 2]
|
2637
2639
|
# perms = []
|
@@ -2646,14 +2648,14 @@ class Array[unchecked out Elem] < Object
|
|
2646
2648
|
# a.permutation(3) {|perm| perms.push(perm) }
|
2647
2649
|
# perms # => [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
|
2648
2650
|
#
|
2649
|
-
# When `
|
2651
|
+
# When `count` is zero, calls the block once with a new empty array:
|
2650
2652
|
#
|
2651
2653
|
# perms = []
|
2652
2654
|
# a.permutation(0) {|perm| perms.push(perm) }
|
2653
2655
|
# perms # => [[]]
|
2654
2656
|
#
|
2655
|
-
# When `
|
2656
|
-
# the block:
|
2657
|
+
# When `count` is out of range (negative or larger than `self.size`), does not
|
2658
|
+
# call the block:
|
2657
2659
|
#
|
2658
2660
|
# a.permutation(-1) {|permutation| fail 'Cannot happen' }
|
2659
2661
|
# a.permutation(4) {|permutation| fail 'Cannot happen' }
|
@@ -3092,7 +3094,7 @@ class Array[unchecked out Elem] < Object
|
|
3092
3094
|
# - sample(random: Random) -> object
|
3093
3095
|
# - sample(count, random: Random) -> new_ary
|
3094
3096
|
# -->
|
3095
|
-
# Returns random elements from `self`, as selected by the object given by
|
3097
|
+
# Returns random elements from `self`, as selected by the object given by the
|
3096
3098
|
# keyword argument `random`.
|
3097
3099
|
#
|
3098
3100
|
# With no argument `count` given, returns one random element from `self`:
|
@@ -3105,7 +3107,7 @@ class Array[unchecked out Elem] < Object
|
|
3105
3107
|
#
|
3106
3108
|
# [].sample # => nil
|
3107
3109
|
#
|
3108
|
-
# With non-negative numeric argument `count` given, returns a new array
|
3110
|
+
# With a non-negative numeric argument `count` given, returns a new array
|
3109
3111
|
# containing `count` random elements from `self`:
|
3110
3112
|
#
|
3111
3113
|
# a.sample(3) # => [8, 9, 2]
|
@@ -3127,12 +3129,12 @@ class Array[unchecked out Elem] < Object
|
|
3127
3129
|
#
|
3128
3130
|
# a.sample(50) # => [6, 4, 1, 8, 5, 9, 0, 2, 3, 7]
|
3129
3131
|
#
|
3130
|
-
# The object given with keyword argument `random` is used as the random
|
3131
|
-
# generator:
|
3132
|
+
# The object given with the keyword argument `random` is used as the random
|
3133
|
+
# number generator:
|
3132
3134
|
#
|
3133
3135
|
# a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
3134
|
-
# a.sample(random: Random.new(1))
|
3135
|
-
# a.sample(4, random: Random.new(1))
|
3136
|
+
# a.sample(random: Random.new(1)) # => 6
|
3137
|
+
# a.sample(4, random: Random.new(1)) # => [6, 10, 9, 2]
|
3136
3138
|
#
|
3137
3139
|
# Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
|
3138
3140
|
#
|
@@ -3229,7 +3231,7 @@ class Array[unchecked out Elem] < Object
|
|
3229
3231
|
# - shuffle(random: Random) -> new_array
|
3230
3232
|
# -->
|
3231
3233
|
# Returns a new array containing all elements from `self` in a random order, as
|
3232
|
-
# selected by the object given by keyword argument `random`:
|
3234
|
+
# selected by the object given by the keyword argument `random`:
|
3233
3235
|
#
|
3234
3236
|
# a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
3235
3237
|
# a.shuffle # => [0, 8, 1, 9, 6, 3, 4, 7, 2, 5]
|
@@ -3241,8 +3243,8 @@ class Array[unchecked out Elem] < Object
|
|
3241
3243
|
# a.shuffle # => [1, 0, 1, 1, 0, 0, 1, 0, 0, 1]
|
3242
3244
|
# a.shuffle # => [1, 1, 0, 0, 0, 1, 1, 0, 0, 1]
|
3243
3245
|
#
|
3244
|
-
# The object given with keyword argument `random` is used as the random
|
3245
|
-
# generator.
|
3246
|
+
# The object given with the keyword argument `random` is used as the random
|
3247
|
+
# number generator.
|
3246
3248
|
#
|
3247
3249
|
# Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
|
3248
3250
|
#
|
@@ -3253,20 +3255,20 @@ class Array[unchecked out Elem] < Object
|
|
3253
3255
|
# - shuffle!(random: Random) -> self
|
3254
3256
|
# -->
|
3255
3257
|
# Shuffles all elements in `self` into a random order, as selected by the object
|
3256
|
-
# given by keyword argument `random
|
3258
|
+
# given by the keyword argument `random`. Returns `self`:
|
3257
3259
|
#
|
3258
3260
|
# a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
3259
3261
|
# a.shuffle! # => [5, 3, 8, 7, 6, 1, 9, 4, 2, 0]
|
3260
3262
|
# a.shuffle! # => [9, 4, 0, 6, 2, 8, 1, 5, 3, 7]
|
3261
3263
|
#
|
3262
|
-
#
|
3264
|
+
# Duplicate elements are included:
|
3263
3265
|
#
|
3264
3266
|
# a = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
|
3265
3267
|
# a.shuffle! # => [1, 0, 0, 1, 1, 0, 1, 0, 0, 1]
|
3266
3268
|
# a.shuffle! # => [0, 1, 0, 1, 1, 0, 1, 0, 1, 0]
|
3267
3269
|
#
|
3268
|
-
# The object given with keyword argument `random` is used as the random
|
3269
|
-
# generator.
|
3270
|
+
# The object given with the keyword argument `random` is used as the random
|
3271
|
+
# number generator.
|
3270
3272
|
#
|
3271
3273
|
# Related: see [Methods for Assigning](rdoc-ref:Array@Methods+for+Assigning).
|
3272
3274
|
#
|
@@ -3922,7 +3924,7 @@ class Array[unchecked out Elem] < Object
|
|
3922
3924
|
# <!--
|
3923
3925
|
# rdoc-file=array.c
|
3924
3926
|
# - zip(*other_arrays) -> new_array
|
3925
|
-
# - zip(*other_arrays) {|
|
3927
|
+
# - zip(*other_arrays) {|sub_array| ... } -> nil
|
3926
3928
|
# -->
|
3927
3929
|
# With no block given, combines `self` with the collection of `other_arrays`;
|
3928
3930
|
# returns a new array of sub-arrays:
|
data/core/complex.rbs
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# You can create a Complex object from rectangular coordinates with:
|
13
13
|
#
|
14
|
-
# * A [complex literal](rdoc-ref:
|
14
|
+
# * A [complex literal](rdoc-ref:syntax/literals.rdoc@Complex+Literals).
|
15
15
|
# * Method Complex.rect.
|
16
16
|
# * Method Kernel#Complex, either with numeric arguments or with certain
|
17
17
|
# string arguments.
|
data/core/encoding.rbs
CHANGED
@@ -1302,96 +1302,70 @@ class Encoding::Converter < Object
|
|
1302
1302
|
end
|
1303
1303
|
|
1304
1304
|
# <!-- rdoc-file=transcode.c -->
|
1305
|
-
# AFTER_OUTPUT
|
1306
|
-
#
|
1307
1305
|
# Stop converting after some output is complete but before all of the input was
|
1308
1306
|
# consumed. See primitive_convert for an example.
|
1309
1307
|
#
|
1310
1308
|
Encoding::Converter::AFTER_OUTPUT: Integer
|
1311
1309
|
|
1312
1310
|
# <!-- rdoc-file=transcode.c -->
|
1313
|
-
# CRLF_NEWLINE_DECORATOR
|
1314
|
-
#
|
1315
1311
|
# Decorator for converting LF to CRLF
|
1316
1312
|
#
|
1317
1313
|
Encoding::Converter::CRLF_NEWLINE_DECORATOR: Integer
|
1318
1314
|
|
1319
1315
|
# <!-- rdoc-file=transcode.c -->
|
1320
|
-
# CR_NEWLINE_DECORATOR
|
1321
|
-
#
|
1322
1316
|
# Decorator for converting LF to CR
|
1323
1317
|
#
|
1324
1318
|
Encoding::Converter::CR_NEWLINE_DECORATOR: Integer
|
1325
1319
|
|
1326
1320
|
# <!-- rdoc-file=transcode.c -->
|
1327
|
-
# INVALID_MASK
|
1328
|
-
#
|
1329
1321
|
# Mask for invalid byte sequences
|
1330
1322
|
#
|
1331
1323
|
Encoding::Converter::INVALID_MASK: Integer
|
1332
1324
|
|
1333
1325
|
# <!-- rdoc-file=transcode.c -->
|
1334
|
-
# INVALID_REPLACE
|
1335
|
-
#
|
1336
1326
|
# Replace invalid byte sequences
|
1337
1327
|
#
|
1338
1328
|
Encoding::Converter::INVALID_REPLACE: Integer
|
1339
1329
|
|
1340
1330
|
# <!-- rdoc-file=transcode.c -->
|
1341
|
-
# PARTIAL_INPUT
|
1342
|
-
#
|
1343
1331
|
# Indicates the source may be part of a larger string. See primitive_convert
|
1344
1332
|
# for an example.
|
1345
1333
|
#
|
1346
1334
|
Encoding::Converter::PARTIAL_INPUT: Integer
|
1347
1335
|
|
1348
1336
|
# <!-- rdoc-file=transcode.c -->
|
1349
|
-
# UNDEF_HEX_CHARREF
|
1350
|
-
#
|
1351
1337
|
# Replace byte sequences that are undefined in the destination encoding with an
|
1352
1338
|
# XML hexadecimal character reference. This is valid for XML conversion.
|
1353
1339
|
#
|
1354
1340
|
Encoding::Converter::UNDEF_HEX_CHARREF: Integer
|
1355
1341
|
|
1356
1342
|
# <!-- rdoc-file=transcode.c -->
|
1357
|
-
# UNDEF_MASK
|
1358
|
-
#
|
1359
1343
|
# Mask for a valid character in the source encoding but no related character(s)
|
1360
1344
|
# in destination encoding.
|
1361
1345
|
#
|
1362
1346
|
Encoding::Converter::UNDEF_MASK: Integer
|
1363
1347
|
|
1364
1348
|
# <!-- rdoc-file=transcode.c -->
|
1365
|
-
# UNDEF_REPLACE
|
1366
|
-
#
|
1367
1349
|
# Replace byte sequences that are undefined in the destination encoding.
|
1368
1350
|
#
|
1369
1351
|
Encoding::Converter::UNDEF_REPLACE: Integer
|
1370
1352
|
|
1371
1353
|
# <!-- rdoc-file=transcode.c -->
|
1372
|
-
# UNIVERSAL_NEWLINE_DECORATOR
|
1373
|
-
#
|
1374
1354
|
# Decorator for converting CRLF and CR to LF
|
1375
1355
|
#
|
1376
1356
|
Encoding::Converter::UNIVERSAL_NEWLINE_DECORATOR: Integer
|
1377
1357
|
|
1378
1358
|
# <!-- rdoc-file=transcode.c -->
|
1379
|
-
# XML_ATTR_CONTENT_DECORATOR
|
1380
|
-
#
|
1381
1359
|
# Escape as XML AttValue
|
1382
1360
|
#
|
1383
1361
|
Encoding::Converter::XML_ATTR_CONTENT_DECORATOR: Integer
|
1384
1362
|
|
1385
1363
|
# <!-- rdoc-file=transcode.c -->
|
1386
|
-
# XML_ATTR_QUOTE_DECORATOR
|
1387
|
-
#
|
1388
1364
|
# Escape as XML AttValue
|
1389
1365
|
#
|
1390
1366
|
Encoding::Converter::XML_ATTR_QUOTE_DECORATOR: Integer
|
1391
1367
|
|
1392
1368
|
# <!-- rdoc-file=transcode.c -->
|
1393
|
-
# XML_TEXT_DECORATOR
|
1394
|
-
#
|
1395
1369
|
# Escape as XML CharData
|
1396
1370
|
#
|
1397
1371
|
Encoding::Converter::XML_TEXT_DECORATOR: Integer
|
data/core/errors.rbs
CHANGED
@@ -188,6 +188,10 @@ 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
|
+
#
|
191
195
|
class LoadError < ScriptError
|
192
196
|
# <!-- rdoc-file=error.c -->
|
193
197
|
# the path that failed to load
|