Created
June 21, 2012 00:46
-
-
Save danielmorrison/2963190 to your computer and use it in GitHub Desktop.
There *is* an I in team!
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
# Inspired by http://www.neatorama.com/2012/06/13/there-is-an-i-in-team/ | |
class String | |
alias_method :original_count, :count | |
def count(letter) | |
if self == 'team' && letter.downcase == 'i' | |
1 | |
else | |
original_count(letter) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Written during a Ruby class I was teaching today. When the group saw the built in string function count:
We decided to alter it to show the hidden i in team