| Class | Dramatis::Future::Interface |
| In: |
lib/dramatis/future/interface.rb
|
| Parent: | Object |
A Dramatis::Future::Interface object provides the ability to observe and access the semantics of a future. It is typically created via Dramatis.interface.
Returns true if the future may be evaluated without blocking. Returns false if the value is not yet available.
Once a future is ready it cannot become unready, so once ready? returns true, it will always be true and value access will never block.
# File lib/dramatis/future/interface.rb, line 38
38: def ready?
39: @future.instance_eval do
40: @continuation.ready?
41: end
42: end
Returns the native value of the future. If the value of the future is not yet available, the method blocks (with rpc gating semantics) until it is.
In many cases, this method is not necessary since the method_missing method on the future will catch most attempts to accesses the value. This method may be necessary in corner cases, for example when using conditionals, conversions, and metaprogramming.
# File lib/dramatis/future/interface.rb, line 23
23: def value
24: @future.instance_eval do
25: @continuation.value
26: end
27: end