Skip to content

Instantly share code, notes, and snippets.

@jackieiscool
Created June 18, 2012 02:40
Show Gist options
  • Save jackieiscool/2946534 to your computer and use it in GitHub Desktop.
Save jackieiscool/2946534 to your computer and use it in GitHub Desktop.
Re-implement Array#count -- HELP
class Array
def new_count
final = 0
(1..self.length-1)each do |i|
final += 1 if yield(self[i])
end
return final
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment