summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-29 10:32:27 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-29 10:32:27 +0000
commitd5b7fc432f0c07dbebb070ef6af17b7d5db6c066 (patch)
tree20c0598f7a5f4f2b833d859c1a0f244733d68fa6 /array.c
parent18a8812e365f493d9de13d28ae0c1ad85c1ab838 (diff)
* array.c: Improve documentation about
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
Diffstat (limited to 'array.c')
-rw-r--r--array.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/array.c b/array.c
index f221a614c9..5d91b38884 100644
--- a/array.c
+++ b/array.c
@@ -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 ]
*
@@ -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' ]
*
@@ -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.
@@ -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" ]
@@ -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"]