Bug #5425 » 0001-Improves-array-examples-for-uniq-uniq.patch
array.c | ||
---|---|---|
* call-seq:
|
||
* ary.uniq! -> ary or nil
|
||
*
|
||
* Removes duplicate elements from +self+.
|
||
* Removes duplicate elements from +self+. If a block is given,
|
||
* it will use the return value of the block for comparison.
|
||
* Returns <code>nil</code> if no changes are made (that is, no
|
||
* duplicates are found).
|
||
*
|
||
* a = [ "a", "a", "b", "b", "c" ]
|
||
* a.uniq! #=> ["a", "b", "c"]
|
||
*
|
||
* b = [ "a", "b", "c" ]
|
||
* b.uniq! #=> nil
|
||
* c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ]
|
||
* c.uniq! {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ]
|
||
*
|
||
* c = [["student","sam"], ["student","george"], ["teacher","matz"]]
|
||
* c.uniq!{ |s| s.first } #=> [["student", "sam"], ["teacher", "matz"]]
|
||
*
|
||
*/
|
||
static VALUE
|
||
... | ... | |
* call-seq:
|
||
* ary.uniq -> new_ary
|
||
*
|
||
* Returns a new array by removing duplicate values in +self+.
|
||
* Returns a new array by removing duplicate values in +self+. If a block
|
||
* is given, it will use the return value of that block as the values to
|
||
* filter.
|
||
*
|
||
* a = [ "a", "a", "b", "b", "c" ]
|
||
* a.uniq #=> ["a", "b", "c"]
|
||
* c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ]
|
||
* c.uniq {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ]
|
||
*
|
||
* b = [["student","sam"], ["student","george"], ["teacher","matz"]]
|
||
* b.uniq!{ |s| s.first } #=> [["student", "sam"], ["teacher", "matz"]]
|
||
*
|
||
*/
|
||
static VALUE
|