Created
September 17, 2008 22:47
-
-
Save wilson/11319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/kernel/common/enumerable.rb b/kernel/common/enumerable.rb | |
index 9fb2f34..8a4008f 100644 | |
--- a/kernel/common/enumerable.rb | |
+++ b/kernel/common/enumerable.rb | |
@@ -457,9 +457,11 @@ module Enumerable | |
# %w[ant bear cat].all? { |word| word.length >= 4} #=> false | |
# [ nil, true, 99 ].all? #=> false | |
- def all?(&prc) | |
- prc = Proc.new { |obj| obj } unless block_given? | |
- each { |o| return false unless prc.call(o) } | |
+ def all? | |
+ each do |o| | |
+ ret = yield(o) | |
+ return false unless ret | |
+ end | |
true | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment