0001-Improves-array-examples-for-uniq-uniq.patch

Alvaro Pereyra Rabanal, 10/09/2011 08:04 AM

Download (1.93 KB)

View differences:

array.c
3509 3509
 *  call-seq:
3510 3510
 *     ary.uniq! -> ary or nil
3511 3511
 *
3512
 *  Removes duplicate elements from +self+.
3512
 *  Removes duplicate elements from +self+. If a block is given,
3513
 *  it will use the return value of the block for comparison.
3513 3514
 *  Returns <code>nil</code> if no changes are made (that is, no
3514 3515
 *  duplicates are found).
3515 3516
 *
3516 3517
 *     a = [ "a", "a", "b", "b", "c" ]
3517 3518
 *     a.uniq!   #=> ["a", "b", "c"]
3519
 *
3518 3520
 *     b = [ "a", "b", "c" ]
3519 3521
 *     b.uniq!   #=> nil
3520
 *     c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ]
3521
 *     c.uniq! {|s| s[/^\w+/]}  #=> [ "a:def", "b:abc", "c:jkl" ]
3522
 *
3523
 *     c = [["student","sam"], ["student","george"], ["teacher","matz"]]
3524
 *     c.uniq!{ |s| s.first } #=> [["student", "sam"], ["teacher", "matz"]] 
3525
 * 
3522 3526
 */
3523 3527

  
3524 3528
static VALUE
......
3565 3569
 *  call-seq:
3566 3570
 *     ary.uniq   -> new_ary
3567 3571
 *
3568
 *  Returns a new array by removing duplicate values in +self+.
3572
 *  Returns a new array by removing duplicate values in +self+. If a block
3573
 *  is given, it will use the return value of that block as the values to 
3574
 *  filter.
3569 3575
 *
3570 3576
 *     a = [ "a", "a", "b", "b", "c" ]
3571 3577
 *     a.uniq   #=> ["a", "b", "c"]
3572
 *     c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ]
3573
 *     c.uniq {|s| s[/^\w+/]}  #=> [ "a:def", "b:abc", "c:jkl" ]
3578
 *
3579
 *     b = [["student","sam"], ["student","george"], ["teacher","matz"]]
3580
 *     b.uniq!{ |s| s.first } #=> [["student", "sam"], ["teacher", "matz"]] 
3581
 * 
3574 3582
 */
3575 3583

  
3576 3584
static VALUE
3577
-