Skip to content

Instantly share code, notes, and snippets.

@gstark
Created January 22, 2010 15:51
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 gstark/283865 to your computer and use it in GitHub Desktop.
Save gstark/283865 to your computer and use it in GitHub Desktop.
require 'enumerator'
class Always42
include Enumerable
def each
while true
yield 42
end
end
end
d = Always42.new
e = d.to_enum
p e.next
p e.next
p e.next
p e.next
p e.next
p e.next
puts "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment