7070#
7171# You can create an Array object explicitly with:
7272#
73- # * An [array literal](rdoc-ref:literals.rdoc@Array+Literals):
73+ # * An [array literal](rdoc-ref:syntax/ literals.rdoc@Array+Literals):
7474#
7575# [1, 'one', :one, [2, 'two', :two]]
7676#
77- # * A [%w or %W: string-array
78- # Literal](rdoc-ref:literals.rdoc@25w+and+-25W-3A+String-Array+Literals):
77+ # * A [%w or %W string-array
78+ # Literal](rdoc-ref:syntax/literals.rdoc@25w+and+-25W-3A+String-Array+Litera
79+ # ls):
7980#
8081# %w[foo bar baz] # => ["foo", "bar", "baz"]
8182# %w[1 % *] # => ["1", "%", "*"]
8283#
83- # * A [%i pr %I: symbol-array
84- # Literal](rdoc-ref:literals.rdoc@25i+and+-25I-3A+Symbol-Array+Literals):
84+ # * A [%i or %I symbol-array
85+ # Literal](rdoc-ref:syntax/literals.rdoc@25i+and+-25I-3A+Symbol-Array+Litera
86+ # ls):
8587#
8688# %i[foo bar baz] # => [:foo, :bar, :baz]
8789# %i[1 % *] # => [:"1", :%, :*]
@@ -677,7 +679,7 @@ class Array[unchecked out Elem] < Object
677679 # When string argument `string_separator` is given, equivalent to
678680 # `self.join(string_separator)`:
679681 #
680- # [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {: foo=> 0}"
682+ # [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {foo: 0}"
681683 #
682684 def * : (string str) -> ::String
683685 | (int int) -> ::Array[Elem]
@@ -1293,13 +1295,13 @@ class Array[unchecked out Elem] < Object
12931295
12941296 # <!--
12951297 # rdoc-file=array.c
1296- # - combination(n ) {|element| ... } -> self
1297- # - combination(n ) -> new_enumerator
1298+ # - combination(count ) {|element| ... } -> self
1299+ # - combination(count ) -> new_enumerator
12981300 # -->
12991301 # When a block and a positive [integer-convertible
13001302 # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects)
1301- # argument `n ` (`0 < n <= self.size`) are given, calls the block with all
1302- # `n`-tuple combinations of `self`; returns `self`:
1303+ # argument `count ` (`0 < count <= self.size`) are given, calls the block with
1304+ # each combination of `self` of size `count `; returns `self`:
13031305 #
13041306 # a = %w[a b c] # => ["a", "b", "c"]
13051307 # a.combination(2) {|combination| p combination } # => ["a", "b", "c"]
@@ -1312,7 +1314,7 @@ class Array[unchecked out Elem] < Object
13121314 #
13131315 # The order of the yielded combinations is not guaranteed.
13141316 #
1315- # When `n ` is zero, calls the block once with a new empty array:
1317+ # When `count ` is zero, calls the block once with a new empty array:
13161318 #
13171319 # a.combination(0) {|combination| p combination }
13181320 # [].combination(0) {|combination| p combination }
@@ -1322,8 +1324,8 @@ class Array[unchecked out Elem] < Object
13221324 # []
13231325 # []
13241326 #
1325- # When `n ` is negative or larger than `self.size` and `self` is non-empty, does
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:
13271329 #
13281330 # a.combination(-1) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
13291331 # a.combination(4) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
@@ -1583,10 +1585,10 @@ class Array[unchecked out Elem] < Object
15831585
15841586 # <!--
15851587 # rdoc-file=array.c
1586- # - drop(n ) -> new_array
1588+ # - drop(count ) -> new_array
15871589 # -->
1588- # Returns a new array containing all but the first `n ` element of `self`, where
1589- # `n ` is a non-negative Integer ; does not modify `self`.
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`.
15901592 #
15911593 # Examples:
15921594 #
@@ -1766,34 +1768,34 @@ class Array[unchecked out Elem] < Object
17661768 # <!--
17671769 # rdoc-file=array.rb
17681770 # - fetch_values(*indexes) -> new_array
1769- # - fetch_values(*indexes) {|index| ... } -> new_array
1771+ # - fetch_values(*indexes) { |index| ... } -> new_array
17701772 # -->
17711773 # With no block given, returns a new array containing the elements of `self` at
1772- # the offsets given by `indexes`; each of the `indexes` must be an
1774+ # the offsets specified by `indexes`. Each of the `indexes` must be an
17731775 # [integer-convertible
17741776 # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects):
17751777 #
17761778 # a = [:foo, :bar, :baz]
1777- # a.fetch_values(3, 1 ) # => [:baz, :foo]
1778- # a.fetch_values(3 .1, 1 ) # => [:baz, :foo]
1779+ # a.fetch_values(2, 0 ) # => [:baz, :foo]
1780+ # a.fetch_values(2 .1, 0 ) # => [:baz, :foo]
17791781 # a.fetch_values # => []
17801782 #
17811783 # For a negative index, counts backwards from the end of the array:
17821784 #
1783- # a.fetch_values([ -2, -1] ) # [:bar, :baz]
1785+ # a.fetch_values(-2, -1) # [:bar, :baz]
17841786 #
17851787 # When no block is given, raises an exception if any index is out of range.
17861788 #
17871789 # With a block given, for each index:
17881790 #
1789- # * If the index in in range, uses an element of `self` (as above).
1790- # * Otherwise calls, the block with the index, and uses the block's return
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
17911793 # value.
17921794 #
17931795 # Example:
17941796 #
17951797 # 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 }
17971799 # # => [:bar, :foo, "42", "777"]
17981800 #
17991801 # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
@@ -2070,7 +2072,7 @@ class Array[unchecked out Elem] < Object
20702072 #
20712073 # [].first # => nil
20722074 #
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`
20742076 # elements (as available) in a new array:
20752077 #
20762078 # a.first(0) # => []
@@ -2348,7 +2350,7 @@ class Array[unchecked out Elem] < Object
23482350 # <!--
23492351 # rdoc-file=array.rb
23502352 # - last -> last_object or nil
2351- # - last(n ) -> new_array
2353+ # - last(count ) -> new_array
23522354 # -->
23532355 # Returns elements from `self`, or `nil`; `self` is not modified.
23542356 #
@@ -2359,8 +2361,8 @@ class Array[unchecked out Elem] < Object
23592361 # a # => [:foo, "bar", 2]
23602362 # [].last # => nil
23612363 #
2362- # With non-negative integer argument `n` is given, returns a new array
2363- # containing the trailing `n ` elements of `self`, as available:
2364+ # With non-negative integer argument `count` given, returns a new array
2365+ # containing the trailing `count ` elements of `self`, as available:
23642366 #
23652367 # a = [:foo, 'bar', 2]
23662368 # a.last(2) # => ["bar", 2]
@@ -2419,9 +2421,9 @@ class Array[unchecked out Elem] < Object
24192421 # <!--
24202422 # rdoc-file=array.c
24212423 # - max -> element
2422- # - max(n ) -> new_array
2424+ # - max(count ) -> new_array
24232425 # - max {|a, b| ... } -> element
2424- # - max(n ) {|a, b| ... } -> new_array
2426+ # - max(count ) {|a, b| ... } -> new_array
24252427 # -->
24262428 # Returns one of the following:
24272429 #
@@ -2438,8 +2440,8 @@ class Array[unchecked out Elem] < Object
24382440 #
24392441 # [1, 0, 3, 2].max # => 3
24402442 #
2441- # With non-negative numeric argument `n ` and no block, returns a new array with
2442- # at most `n ` elements, in descending order, per method `#<=>`:
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 `#<=>`:
24432445 #
24442446 # [1, 0, 3, 2].max(3) # => [3, 2, 1]
24452447 # [1, 0, 3, 2].max(3.0) # => [3, 2, 1]
@@ -2454,8 +2456,8 @@ class Array[unchecked out Elem] < Object
24542456 # ['0', '', '000', '00'].max {|a, b| a.size <=> b.size }
24552457 # # => "000"
24562458 #
2457- # With non-negative numeric argument `n ` and a block, returns a new array with
2458- # at most `n ` elements, in descending order, per the block:
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:
24592461 #
24602462 # ['0', '', '000', '00'].max(2) {|a, b| a.size <=> b.size }
24612463 # # => ["000", "00"]
@@ -2470,9 +2472,9 @@ class Array[unchecked out Elem] < Object
24702472 # <!--
24712473 # rdoc-file=array.c
24722474 # - min -> element
2473- # - min(n ) -> new_array
2475+ # - min(count ) -> new_array
24742476 # - min {|a, b| ... } -> element
2475- # - min(n ) {|a, b| ... } -> new_array
2477+ # - min(count ) {|a, b| ... } -> new_array
24762478 # -->
24772479 # Returns one of the following:
24782480 #
@@ -2489,8 +2491,8 @@ class Array[unchecked out Elem] < Object
24892491 #
24902492 # [1, 0, 3, 2].min # => 0
24912493 #
2492- # With non-negative numeric argument `n ` and no block, returns a new array with
2493- # at most `n ` elements, in ascending order, per method `#<=>`:
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 `#<=>`:
24942496 #
24952497 # [1, 0, 3, 2].min(3) # => [0, 1, 2]
24962498 # [1, 0, 3, 2].min(3.0) # => [0, 1, 2]
@@ -2505,8 +2507,8 @@ class Array[unchecked out Elem] < Object
25052507 # ['0', '', '000', '00'].min {|a, b| a.size <=> b.size }
25062508 # # => ""
25072509 #
2508- # With non-negative numeric argument `n ` and a block, returns a new array with
2509- # at most `n ` elements, in ascending order, per the block:
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:
25102512 #
25112513 # ['0', '', '000', '00'].min(2) {|a, b| a.size <=> b.size }
25122514 # # => ["", "0"]
@@ -2623,15 +2625,15 @@ class Array[unchecked out Elem] < Object
26232625
26242626 # <!--
26252627 # rdoc-file=array.c
2626- # - permutation(n = self.size) {|permutation| ... } -> self
2627- # - permutation(n = self.size) -> new_enumerator
2628+ # - permutation(count = self.size) {|permutation| ... } -> self
2629+ # - permutation(count = self.size) -> new_enumerator
26282630 # -->
26292631 # Iterates over permutations of the elements of `self`; the order of
26302632 # permutations is indeterminate.
26312633 #
2632- # With a block and an in-range positive integer argument `n ` (`0 < n <=
2633- # self.size`) given, calls the block with each `n`-tuple permutations of `self`;
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`:
26352637 #
26362638 # a = [0, 1, 2]
26372639 # perms = []
@@ -2646,14 +2648,14 @@ class Array[unchecked out Elem] < Object
26462648 # a.permutation(3) {|perm| perms.push(perm) }
26472649 # perms # => [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
26482650 #
2649- # When `n ` is zero, calls the block once with a new empty array:
2651+ # When `count ` is zero, calls the block once with a new empty array:
26502652 #
26512653 # perms = []
26522654 # a.permutation(0) {|perm| perms.push(perm) }
26532655 # perms # => [[]]
26542656 #
2655- # When `n ` is out of range (negative or larger than `self.size`), does not call
2656- # the block:
2657+ # When `count ` is out of range (negative or larger than `self.size`), does not
2658+ # call the block:
26572659 #
26582660 # a.permutation(-1) {|permutation| fail 'Cannot happen' }
26592661 # a.permutation(4) {|permutation| fail 'Cannot happen' }
@@ -3092,7 +3094,7 @@ class Array[unchecked out Elem] < Object
30923094 # - sample(random: Random) -> object
30933095 # - sample(count, random: Random) -> new_ary
30943096 # -->
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
30963098 # keyword argument `random`.
30973099 #
30983100 # With no argument `count` given, returns one random element from `self`:
@@ -3105,7 +3107,7 @@ class Array[unchecked out Elem] < Object
31053107 #
31063108 # [].sample # => nil
31073109 #
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
31093111 # containing `count` random elements from `self`:
31103112 #
31113113 # a.sample(3) # => [8, 9, 2]
@@ -3127,12 +3129,12 @@ class Array[unchecked out Elem] < Object
31273129 #
31283130 # a.sample(50) # => [6, 4, 1, 8, 5, 9, 0, 2, 3, 7]
31293131 #
3130- # The object given with keyword argument `random` is used as the random number
3131- # generator:
3132+ # The object given with the keyword argument `random` is used as the random
3133+ # number generator:
31323134 #
31333135 # a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
3134- # a.sample(random: Random.new(1)) #=> 6
3135- # a.sample(4, random: Random.new(1)) #=> [6, 10, 9, 2]
3136+ # a.sample(random: Random.new(1)) # => 6
3137+ # a.sample(4, random: Random.new(1)) # => [6, 10, 9, 2]
31363138 #
31373139 # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
31383140 #
@@ -3229,7 +3231,7 @@ class Array[unchecked out Elem] < Object
32293231 # - shuffle(random: Random) -> new_array
32303232 # -->
32313233 # 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`:
32333235 #
32343236 # a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
32353237 # a.shuffle # => [0, 8, 1, 9, 6, 3, 4, 7, 2, 5]
@@ -3241,8 +3243,8 @@ class Array[unchecked out Elem] < Object
32413243 # a.shuffle # => [1, 0, 1, 1, 0, 0, 1, 0, 0, 1]
32423244 # a.shuffle # => [1, 1, 0, 0, 0, 1, 1, 0, 0, 1]
32433245 #
3244- # The object given with keyword argument `random` is used as the random number
3245- # generator.
3246+ # The object given with the keyword argument `random` is used as the random
3247+ # number generator.
32463248 #
32473249 # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
32483250 #
@@ -3253,20 +3255,20 @@ class Array[unchecked out Elem] < Object
32533255 # - shuffle!(random: Random) -> self
32543256 # -->
32553257 # Shuffles all elements in `self` into a random order, as selected by the object
3256- # given by keyword argument `random`; returns `self`:
3258+ # given by the keyword argument `random`. Returns `self`:
32573259 #
32583260 # a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
32593261 # a.shuffle! # => [5, 3, 8, 7, 6, 1, 9, 4, 2, 0]
32603262 # a.shuffle! # => [9, 4, 0, 6, 2, 8, 1, 5, 3, 7]
32613263 #
3262- # Duplicate elements are included:
3264+ # Duplicate elements are included:
32633265 #
32643266 # a = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
32653267 # a.shuffle! # => [1, 0, 0, 1, 1, 0, 1, 0, 0, 1]
32663268 # a.shuffle! # => [0, 1, 0, 1, 1, 0, 1, 0, 1, 0]
32673269 #
3268- # The object given with keyword argument `random` is used as the random number
3269- # generator.
3270+ # The object given with the keyword argument `random` is used as the random
3271+ # number generator.
32703272 #
32713273 # Related: see [Methods for Assigning](rdoc-ref:Array@Methods+for+Assigning).
32723274 #
@@ -3922,7 +3924,7 @@ class Array[unchecked out Elem] < Object
39223924 # <!--
39233925 # rdoc-file=array.c
39243926 # - zip(*other_arrays) -> new_array
3925- # - zip(*other_arrays) {|other_array | ... } -> nil
3927+ # - zip(*other_arrays) {|sub_array | ... } -> nil
39263928 # -->
39273929 # With no block given, combines `self` with the collection of `other_arrays`;
39283930 # returns a new array of sub-arrays:
0 commit comments