Skip to content

Instantly share code, notes, and snippets.

@Pcushing
Created June 16, 2012 00:09
Show Gist options
  • Save Pcushing/2939302 to your computer and use it in GitHub Desktop.
Save Pcushing/2939302 to your computer and use it in GitHub Desktop.
Redefining count, but there's got to be a better way...
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