Created
June 16, 2012 00:09
-
-
Save Pcushing/2939302 to your computer and use it in GitHub Desktop.
Redefining count, but there's got to be a better way...
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
class Array | |
def new_count | |
count = 0 | |
(1..self.length).each do |i| | |
count += 1 if yield(self[i-1]) | |
end | |
count | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment