Skip to content

Commit 50a6782

Browse files
[DOC] Change arg names from n to count (#12288)
1 parent 86cf18e commit 50a6782

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

array.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5973,9 +5973,9 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax)
59735973
/*
59745974
* call-seq:
59755975
* max -> element
5976-
* max(n) -> new_array
5976+
* max(count) -> new_array
59775977
* max {|a, b| ... } -> element
5978-
* max(n) {|a, b| ... } -> new_array
5978+
* max(count) {|a, b| ... } -> new_array
59795979
*
59805980
* Returns one of the following:
59815981
*
@@ -5992,8 +5992,8 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax)
59925992
*
59935993
* [1, 0, 3, 2].max # => 3
59945994
*
5995-
* With non-negative numeric argument +n+ and no block,
5996-
* returns a new array with at most +n+ elements,
5995+
* With non-negative numeric argument +count+ and no block,
5996+
* returns a new array with at most +count+ elements,
59975997
* in descending order, per method <tt>#<=></tt>:
59985998
*
59995999
* [1, 0, 3, 2].max(3) # => [3, 2, 1]
@@ -6009,8 +6009,8 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax)
60096009
* ['0', '', '000', '00'].max {|a, b| a.size <=> b.size }
60106010
* # => "000"
60116011
*
6012-
* With non-negative numeric argument +n+ and a block,
6013-
* returns a new array with at most +n+ elements,
6012+
* With non-negative numeric argument +count+ and a block,
6013+
* returns a new array with at most +count+ elements,
60146014
* in descending order, per the block:
60156015
*
60166016
* ['0', '', '000', '00'].max(2) {|a, b| a.size <=> b.size }
@@ -6150,9 +6150,9 @@ ary_min_opt_string(VALUE ary, long i, VALUE vmin)
61506150
/*
61516151
* call-seq:
61526152
* min -> element
6153-
* min(n) -> new_array
6153+
* min(count) -> new_array
61546154
* min {|a, b| ... } -> element
6155-
* min(n) {|a, b| ... } -> new_array
6155+
* min(count) {|a, b| ... } -> new_array
61566156
*
61576157
* Returns one of the following:
61586158
*
@@ -6169,8 +6169,8 @@ ary_min_opt_string(VALUE ary, long i, VALUE vmin)
61696169
*
61706170
* [1, 0, 3, 2].min # => 0
61716171
*
6172-
* With non-negative numeric argument +n+ and no block,
6173-
* returns a new array with at most +n+ elements,
6172+
* With non-negative numeric argument +count+ and no block,
6173+
* returns a new array with at most +count+ elements,
61746174
* in ascending order, per method <tt>#<=></tt>:
61756175
*
61766176
* [1, 0, 3, 2].min(3) # => [0, 1, 2]
@@ -6186,8 +6186,8 @@ ary_min_opt_string(VALUE ary, long i, VALUE vmin)
61866186
* ['0', '', '000', '00'].min {|a, b| a.size <=> b.size }
61876187
* # => ""
61886188
*
6189-
* With non-negative numeric argument +n+ and a block,
6190-
* returns a new array with at most +n+ elements,
6189+
* With non-negative numeric argument +count+ and a block,
6190+
* returns a new array with at most +count+ elements,
61916191
* in ascending order, per the block:
61926192
*
61936193
* ['0', '', '000', '00'].min(2) {|a, b| a.size <=> b.size }
@@ -7063,14 +7063,14 @@ rb_ary_permutation_size(VALUE ary, VALUE args, VALUE eobj)
70637063

70647064
/*
70657065
* call-seq:
7066-
* permutation(n = self.size) {|permutation| ... } -> self
7067-
* permutation(n = self.size) -> new_enumerator
7066+
* permutation(count = self.size) {|permutation| ... } -> self
7067+
* permutation(count = self.size) -> new_enumerator
70687068
*
70697069
* Iterates over permutations of the elements of +self+;
70707070
* the order of permutations is indeterminate.
70717071
*
7072-
* With a block and an in-range positive integer argument +n+ (<tt>0 < n <= self.size</tt>) given,
7073-
* calls the block with each +n+-tuple permutations of +self+;
7072+
* With a block and an in-range positive integer argument +count+ (<tt>0 < count <= self.size</tt>) given,
7073+
* calls the block with each permutation of +self+ of size +count+;
70747074
* returns +self+:
70757075
*
70767076
* a = [0, 1, 2]
@@ -7086,13 +7086,13 @@ rb_ary_permutation_size(VALUE ary, VALUE args, VALUE eobj)
70867086
* a.permutation(3) {|perm| perms.push(perm) }
70877087
* perms # => [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
70887088
*
7089-
* When +n+ is zero, calls the block once with a new empty array:
7089+
* When +count+ is zero, calls the block once with a new empty array:
70907090
*
70917091
* perms = []
70927092
* a.permutation(0) {|perm| perms.push(perm) }
70937093
* perms # => [[]]
70947094
*
7095-
* When +n+ is out of range (negative or larger than <tt>self.size</tt>),
7095+
* When +count+ is out of range (negative or larger than <tt>self.size</tt>),
70967096
* does not call the block:
70977097
*
70987098
* a.permutation(-1) {|permutation| fail 'Cannot happen' }
@@ -7173,13 +7173,13 @@ rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
71737173

71747174
/*
71757175
* call-seq:
7176-
* combination(n) {|element| ... } -> self
7177-
* combination(n) -> new_enumerator
7176+
* combination(count) {|element| ... } -> self
7177+
* combination(count) -> new_enumerator
71787178
*
71797179
* When a block and a positive
71807180
* {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]
7181-
* argument +n+ (<tt>0 < n <= self.size</tt>)
7182-
* are given, calls the block with all +n+-tuple combinations of +self+;
7181+
* argument +count+ (<tt>0 < count <= self.size</tt>)
7182+
* are given, calls the block with each combination of +self+ of size +count+;
71837183
* returns +self+:
71847184
*
71857185
* a = %w[a b c] # => ["a", "b", "c"]
@@ -7193,7 +7193,7 @@ rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
71937193
*
71947194
* The order of the yielded combinations is not guaranteed.
71957195
*
7196-
* When +n+ is zero, calls the block once with a new empty array:
7196+
* When +count+ is zero, calls the block once with a new empty array:
71977197
*
71987198
* a.combination(0) {|combination| p combination }
71997199
* [].combination(0) {|combination| p combination }
@@ -7203,7 +7203,7 @@ rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
72037203
* []
72047204
* []
72057205
*
7206-
* When +n+ is negative or larger than +self.size+ and +self+ is non-empty,
7206+
* When +count+ is negative or larger than +self.size+ and +self+ is non-empty,
72077207
* does not call the block:
72087208
*
72097209
* a.combination(-1) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
@@ -7680,10 +7680,10 @@ rb_ary_take_while(VALUE ary)
76807680

76817681
/*
76827682
* call-seq:
7683-
* drop(n) -> new_array
7683+
* drop(count) -> new_array
76847684
*
7685-
* Returns a new array containing all but the first +n+ element of +self+,
7686-
* where +n+ is a non-negative Integer;
7685+
* Returns a new array containing all but the first +count+ element of +self+,
7686+
* where +count+ is a non-negative integer;
76877687
* does not modify +self+.
76887688
*
76897689
* Examples:

array.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ def first n = unspecified = true
140140
end
141141

142142
# call-seq:
143-
# last -> last_object or nil
144-
# last(n) -> new_array
143+
# last -> last_object or nil
144+
# last(count) -> new_array
145145
#
146146
# Returns elements from +self+, or +nil+; +self+ is not modified.
147147
#
@@ -152,8 +152,9 @@ def first n = unspecified = true
152152
# a # => [:foo, "bar", 2]
153153
# [].last # => nil
154154
#
155-
# With a non-negative integer argument +n+ given,
156-
# returns a new array containing the trailing +n+ elements of +self+, as available:
155+
#
156+
# With non-negative integer argument +count+ given,
157+
# returns a new array containing the trailing +count+ elements of +self+, as available:
157158
#
158159
# a = [:foo, 'bar', 2]
159160
# a.last(2) # => ["bar", 2]

0 commit comments

Comments
 (0)