AssociationCollection#any? takes a block [Michael Schoen]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2006-12-05 21:49:36 +00:00
parent 7370e54cc4
commit eb300f8428

@ -116,9 +116,13 @@ def length
def empty?
size.zero?
end
def any?
!empty?
def any?(&block)
if block_given?
method_missing(:any?, &block)
else
!empty?
end
end
def uniq(collection = self)