Class: Airflow::Future
- Inherits:
-
Object
- Object
- Airflow::Future
- Defined in:
- lib/async_flow/future.rb
Instance Method Summary collapse
-
#initialize ⇒ Future
constructor
A new instance of Future.
- #ready? ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize ⇒ Future
Returns a new instance of Future.
5 6 7 8 9 10 |
# File 'lib/async_flow/future.rb', line 5 def initialize @task = Async do |task| task.annotate "Future" @result = yield end end |
Instance Method Details
#ready? ⇒ Boolean
17 18 19 |
# File 'lib/async_flow/future.rb', line 17 def ready? @task.completed? end |
#value ⇒ Object
12 13 14 15 |
# File 'lib/async_flow/future.rb', line 12 def value @task.wait @result end |