Last active
August 29, 2015 14:20
-
-
Save GBH/4dfc2e57c5316c8bd86c to your computer and use it in GitHub Desktop.
each_with_alpha_index
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
module Enumerable | |
# Iterate through enumerable with alpha index instead of integers | |
def each_with_alpha_index(index = 'a') | |
each do |element| | |
yield element, index | |
index.next! | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment