Le 16 mars 2011 à 17:26, Matt Jones a écrit :
>
> This implementation might be more useful (in the block_given? path):
>
> uniq_by(&block).size == size
>
> The result would be that the above example would still work, but you could
> also say things like:
>
> @some_models.uniq? { |x| x.created_at.month }
How would you handle simple cases like: [ 1, 1, 2 ].uniq? { |x| x > 1 } # =>
true ?
--
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.