Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (23 sloc) 0.479 kB
# direct copy, with adaptations, of Generator class by Jim Weirich in Hal Fulton's
# book "The Ruby Way."
class InfiniteStream
def initialize
callcc do |context|
@generator_context = context
return
end
generating_loop
end
def next
callcc do |here|
@main_context = here
@generator_context[]
end
end
def generate(value)
callcc do |context|
@generator_context = context
@main_context[value]
end
end
end
Jump to Line
Something went wrong with that request. Please try again.