Skip to content

Instantly share code, notes, and snippets.

View TooManyBees's full-sized avatar

Jess Bees TooManyBees

  • 271ft above sea level
View GitHub Profile
@TooManyBees
TooManyBees / enumerator_take.rb
Last active August 29, 2015 13:57
Functionality of Enumerator#take but increments the internal pointer
class Enumerator
def ltake(n)
arr = []
n.times { arr << self.next }
arr
rescue StopIteration
arr
end
end