Method: Lazy::Future#initialize
- Defined in:
- lib/core/facets/lazy.rb
#initialize(&computation) ⇒ Future
:nodoc:
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/core/facets/lazy.rb', line 169 def initialize( &computation ) #:nodoc: result = nil exception = nil thread = Thread.new do begin result = computation.call( self ) rescue Exception => exception end end super() do raise DivergenceError.new if Thread.current == thread thread.join raise exception if exception result end end |