Class: Lazy::Future
Overview
A promise whose computation runs asynchronously in the background.
Constant Summary
Constants inherited from Promise
Instance Method Summary collapse
-
#initialize(scheduler = Thread, &computation) ⇒ Future
constructor
:nodoc:.
Methods inherited from Promise
#__result__, #inspect, #marshal_dump, #marshal_load, #method_missing, #respond_to?
Constructor Details
#initialize(scheduler = Thread, &computation) ⇒ Future
:nodoc:
139 140 141 142 143 144 145 |
# File 'lib/lazy.rb', line 139 def initialize( scheduler=Thread, &computation ) #:nodoc: task = scheduler.new { computation.call self } super() do raise DivergenceError if scheduler.current == task task.value end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Lazy::Promise