Hi Chris,

I want to be able to do things like:

[ 1, 2 ].uniq?
[ {:lang => "Ruby"}, {:lang => "ObjC"} ].uniq?
[ 1, 1, 2 ].uniq? { |x| x > 1 }
[ nc,dhh ].uniq? { |p| p.name }

uniq? seems to be a good name to me.  Enumerable#uniq is a good name and 
Enumerable#uniq? is just the same except we are asking, not really removing 
duplicates.

Le 16 mars 2011 à 16:32, Farski a écrit :

> The name #uniq? here is not a good representation of the method's
> functionality here. You're checking for uniqueness of a single member
> of the collection, but in use the context would be the entire
> collection. @people.uniq? being true should mean @people itself is, in
> some way, unique. You'd need to come up with a better way of saying
> @people.has_only_one_of?; it may be tough to come up with an
> intuitive, succinct name for that, and using something long doesn't
> make too much sense when @people.select{}.size==1 is already pretty
> accessible.

-- 
Nicolas Cavigneaux
http://www.bounga.org
http://www.cavigneaux.net



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to