Skip to content

Commit 05f894a

Browse files
[DOC] Tweaks for Array#uniq! (ruby#11950)
1 parent 5c1e432 commit 05f894a

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

array.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6155,32 +6155,30 @@ push_value(st_data_t key, st_data_t val, st_data_t ary)
61556155

61566156
/*
61576157
* call-seq:
6158-
* array.uniq! -> self or nil
6159-
* array.uniq! {|element| ... } -> self or nil
6158+
* uniq! -> self or nil
6159+
* uniq! {|element| ... } -> self or nil
61606160
*
61616161
* Removes duplicate elements from +self+, the first occurrence always being retained;
61626162
* returns +self+ if any elements removed, +nil+ otherwise.
61636163
*
61646164
* With no block given, identifies and removes elements using method <tt>eql?</tt>
6165-
* to compare.
6166-
*
6167-
* Returns +self+ if any elements removed:
6165+
* to compare elements:
61686166
*
61696167
* a = [0, 0, 1, 1, 2, 2]
61706168
* a.uniq! # => [0, 1, 2]
6171-
*
6172-
* Returns +nil+ if no elements removed.
6169+
* a.uniq! # => nil
61736170
*
61746171
* With a block given, calls the block for each element;
6175-
* identifies (using method <tt>eql?</tt>) and removes
6176-
* elements for which the block returns duplicate values.
6177-
*
6178-
* Returns +self+ if any elements removed:
6172+
* identifies and omits "duplicate" elements using method <tt>eql?</tt>
6173+
* to compare <i>block return values</i>;
6174+
* that is, an element is a duplicate if its block return value
6175+
* is the same as that of a previous element:
61796176
*
61806177
* a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb']
6181-
* a.uniq! {|element| element.size } # => ['a', 'aa', 'aaa']
6178+
* a.uniq! {|element| element.size } # => ["a", "aa", "aaa"]
6179+
* a.uniq! {|element| element.size } # => nil
61826180
*
6183-
* Returns +nil+ if no elements removed.
6181+
* Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
61846182
*/
61856183
static VALUE
61866184
rb_ary_uniq_bang(VALUE ary)

0 commit comments

Comments
 (0)