Skip to content

Instantly share code, notes, and snippets.

@GBH
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GBH/4dfc2e57c5316c8bd86c to your computer and use it in GitHub Desktop.
Save GBH/4dfc2e57c5316c8bd86c to your computer and use it in GitHub Desktop.
each_with_alpha_index
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