Created
February 6, 2011 21:57
-
-
Save daniellockard/813758 to your computer and use it in GitHub Desktop.
adds an each_word function to ruby
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 String | |
def each_word | |
self.split.each { |value| | |
return value if yield(value) | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is 12 years old.