Class: Telebugs::Promise
- Inherits:
-
Object
- Object
- Telebugs::Promise
- Defined in:
- lib/telebugs/promise.rb
Overview
Wraps Concurrent::Promise to provide a consistent API for promises that we can control.
Instance Method Summary collapse
- #fulfilled? ⇒ Boolean
-
#initialize ⇒ Promise
constructor
A new instance of Promise.
- #reason ⇒ Object
- #rejected? ⇒ Boolean
- #rescue ⇒ Object
- #then ⇒ Object
- #value ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize ⇒ Promise
Returns a new instance of Promise.
7 8 9 |
# File 'lib/telebugs/promise.rb', line 7 def initialize(...) @future = Concurrent::Promises.future(...) end |
Instance Method Details
#fulfilled? ⇒ Boolean
23 24 25 |
# File 'lib/telebugs/promise.rb', line 23 def fulfilled? @future.fulfilled? end |
#reason ⇒ Object
15 16 17 |
# File 'lib/telebugs/promise.rb', line 15 def reason @future.reason end |
#rejected? ⇒ Boolean
27 28 29 |
# File 'lib/telebugs/promise.rb', line 27 def rejected? @future.rejected? end |
#rescue ⇒ Object
35 36 37 |
# File 'lib/telebugs/promise.rb', line 35 def rescue(...) @future.rescue(...) end |
#then ⇒ Object
31 32 33 |
# File 'lib/telebugs/promise.rb', line 31 def then(...) @future.then(...) end |
#value ⇒ Object
11 12 13 |
# File 'lib/telebugs/promise.rb', line 11 def value @future.value end |
#wait ⇒ Object
19 20 21 |
# File 'lib/telebugs/promise.rb', line 19 def wait @future.wait end |