Skip to content

Commit

Permalink
* array.c: Improve documentation about
Browse files Browse the repository at this point in the history
  comparison by hash for concerned methods. [ruby-core:51266]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
eregon committed Jan 29, 2013
1 parent 18a8812 commit d5b7fc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Tue Jan 29 19:27:18 2013 Benoit Daloze <eregontp@gmail.com>

* array.c: Improve documentation about
comparison by hash for concerned methods. [ruby-core:51266]

Tue Jan 29 17:03:28 2013 Koichi Sasada <ko1@atdot.net>

* vm_backtrace.c: fix issue of rb_debug_inspector_open().
Expand Down
11 changes: 8 additions & 3 deletions array.c
Expand Up @@ -3800,7 +3800,7 @@ ary_recycle_hash(VALUE hash)
* Returns a new array that is a copy of the original array, removing any
* items that also appear in +other_ary+.
*
* It compares elements using their hash (returned by the Object#hash method).
* It compares elements using their #hash and #eql? methods for efficiency.
*
* [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ]
*
Expand Down Expand Up @@ -3832,6 +3832,8 @@ rb_ary_diff(VALUE ary1, VALUE ary2)
* Set Intersection --- Returns a new array containing elements common to the
* two arrays, excluding any duplicates.
*
* It compares elements using their #hash and #eql? methods for efficiency.
*
* [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]
* [ 'a', 'b', 'b', 'z' ] & [ 'a', 'b', 'c' ] #=> [ 'a', 'b' ]
*
Expand Down Expand Up @@ -3872,6 +3874,8 @@ rb_ary_and(VALUE ary1, VALUE ary2)
* Set Union --- Returns a new array by joining +ary+ with +other_ary+,
* excluding any duplicates.
*
* It compares elements using their #hash and #eql? methods for efficiency.
*
* [ "a", "b", "c" ] | [ "c", "d", "a" ] #=> [ "a", "b", "c", "d" ]
*
* See also Array#uniq.
Expand Down Expand Up @@ -3921,6 +3925,8 @@ push_value(st_data_t key, st_data_t val, st_data_t ary)
* If a block is given, it will use the return value of the block for
* comparison.
*
* It compares values using their #hash and #eql? methods for efficiency.
*
* Returns +nil+ if no changes are made (that is, no duplicates are found).
*
* a = [ "a", "a", "b", "b", "c" ]
Expand Down Expand Up @@ -3983,8 +3989,7 @@ rb_ary_uniq_bang(VALUE ary)
*
* If a block is given, it will use the return value of the block for comparison.
*
* It compares elements using their hash (provided by the Object#hash method)
* then compares hashes with Object#eql?.
* It compares values using their #hash and #eql? methods for efficiency.
*
* a = [ "a", "a", "b", "b", "c" ]
* a.uniq # => ["a", "b", "c"]
Expand Down

0 comments on commit d5b7fc4

Please sign in to comment.