-
-
Save texel/92705bacd37adbf9dd51 to your computer and use it in GitHub Desktop.
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
def block_find(&block) | |
each do |i| | |
result = yield i | |
return result if result | |
end | |
end | |
>> %w(foo bar baz).block_find { |s| s.match(/(o)/) } | |
=> #<MatchData "o" 1:"o"> |
judofyr
commented
Mar 1, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment