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:
parent
7370e54cc4
commit
eb300f8428
@ -117,9 +117,13 @@ def empty?
|
||||
size.zero?
|
||||
end
|
||||
|
||||
def any?
|
||||
def any?(&block)
|
||||
if block_given?
|
||||
method_missing(:any?, &block)
|
||||
else
|
||||
!empty?
|
||||
end
|
||||
end
|
||||
|
||||
def uniq(collection = self)
|
||||
seen = Set.new
|
||||
|
Loading…
Reference in New Issue
Block a user