Skip to content

Instantly share code, notes, and snippets.

@wilson
Created September 17, 2008 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilson/11319 to your computer and use it in GitHub Desktop.
Save wilson/11319 to your computer and use it in GitHub Desktop.
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