Project

General

Profile

Actions

Bug #6872

closed

Array does not specify how it determines uniqueness of values

Added by agrimm (Andrew Grimm) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
Backport:
[ruby-core:47199]

Description

=begin
The documentation of (({Array#uniq})) , and similar methods, does not specify how values are determined to be unique when a block is not given.

The Stack Overflow answer http://stackoverflow.com/a/8779948/38765 explains that (({Array#uniq})) works on the basis of looking at the hash method of each value in the array. However, this is not explained in the documentation of (({Array#uniq})) , or in (({Object#hash})) .

I think, but I'm not 100% sure, that there are other methods in Array that also use the hash method, such as (({Array#-})) . Ideally, all of these methods should be documented as using the hash method.
=end

Actions

Also available in: Atom PDF