2007/8/9, Milo Thurston <knirirr / gmail.com>:
> Konrad Meyer wrote:
> > And only those unique values?
>
> Not only those, but the entire objects.
> I could use something like
>
> names = things.collect {|x| x.name}.uniq
>
> to just get the names, but I need the rest of the data in the object
> also.
> The code I posted works, but I'm not sure that it's the best solution.

Why don't you use #select?

selection = things.select {|x| x.name = "foo"}

Did I misunderstand your requirement?

Kind regards

robert