Skip to content

Instantly share code, notes, and snippets.

@wilson
Created Sep 17, 2008
Embed
What would you like to do?
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