Class: Promise::Trace
Instance Attribute Summary
Attributes inherited from Promise
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(block) ⇒ Trace
constructor
A new instance of Trace.
Methods inherited from Promise
#<<, #>>, #^, #act?, #always, error, #exception!, #exception?, #fail, #inspect, #realized?, #reject, #reject!, #rejected?, #resolve, #resolve!, #resolved?, #then, #trace, value, when
Constructor Details
Class Method Details
.it(promise) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'opal/stdlib/promise.rb', line 198 def self.it(promise) unless promise.realized? raise ArgumentError, "the promise hasn't been realized" end current = promise.act? ? [promise.value] : [] if prev = promise.prev current.concat(it(prev)) else current end end |