Module: SinglePrompt
- Defined in:
- lib/cont/single_prompt.rb
Defined Under Namespace
Classes: DeadContinuationError, UnexpectedStatusError
Class Method Summary collapse
-
.reset {|block| ... } ⇒ Object
Limit the continuation to the current block.
-
.shift {|block| ... } ⇒ Object
Capture the current continuation.
Class Method Details
.reset {|block| ... } ⇒ Object
Limit the continuation to the current block.
16 17 18 |
# File 'lib/cont/single_prompt.rb', line 16 def self.reset(&block) prompt0(&block) end |
.shift {|block| ... } ⇒ Object
Capture the current continuation.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cont/single_prompt.rb', line 24 def self.shift(&block) control0 do |fiber| prompt0 do block.call lambda { |value| prompt0 do raise DeadContinuationError.new unless fiber.alive? run(fiber, :resume, lambda { value }) end } end end end |