Created
July 17, 2011 07:52
-
-
Save pasberth/1087333 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
# ary = [0, 1, 2, 3] | |
# ary.shift.foo until ary.empty? | |
# | |
# is equal to: | |
# | |
# ary = [0, 1, 2, 3] | |
# ary.featch { |e| e.foo } | |
class Array | |
# naming of 'fetch each' => featch | |
def featch | |
yield shift until empty? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment