Created
July 4, 2009 16:36
-
-
Save softprops/140624 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Array.class_eval { | |
# [1,2,3,4].each_with_previous do |el, prev| | |
# p "el:#{el}, prev:#{prev}" | |
# end | |
# | |
def each_with_previous | |
prev = nil | |
each do |el| | |
yield(el, prev) | |
prev = el | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment