Re: Array#uniq vs Array#-
Gerald Bauer <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAAxEZd_K-qXcdP=K0hZ05QV3MFAPnoDWwQELL9XGE1y=OvJhXQ@mail.gmail.com> |
Hello,
If you Google "ruby uniq" I get as the 2nd result the article:
More than you care to know about the uniq method [1] by Chris Holz
that tells you with many code examples:
> Multiple instances of the same classes (Object.new) are treated distinctly
> and do not reduce to a single object in the returned array.
Try:
[Any,Any].uniq
=> [Any]
that will work as you expect.
Cheers. Prost.
[1] http://chrisholtz.com/blog/more-than-you-care-to-know-about-the-uniq-method/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>