Skip to content

Instantly share code, notes, and snippets.

View cjbrigato's full-sized avatar

Colin J. Brigato cjbrigato

View GitHub Profile
@2called-chaos
2called-chaos / each_with_position.rb
Created October 2, 2012 22:56
Ruby Enumerable each_with_position (provides #first? #last? #prev #next ...)
##################################
### SCROLL DOWN FOR AN EXAMPLE ###
##################################
module Enumerable
# your each_with_position method
def each_pos &block
EachWithPosition.each(self, &block)
end
end