Class: IOPromise::Faraday::FaradayPromise
- Inherits:
-
Base
- Object
- Promise
- Base
- IOPromise::Faraday::FaradayPromise
show all
- Defined in:
- lib/iopromise/faraday/promise.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#beginning, #fulfill, #instrument, #notify_completion, #reject, #started_executing?
Constructor Details
#initialize(response = nil) ⇒ FaradayPromise
Returns a new instance of FaradayPromise.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/iopromise/faraday/promise.rb', line 13
def initialize(response = nil)
super()
@response = response
@started = false
unless @response.nil?
@response.on_complete do |response_env|
fulfill(@response)
execute_pool.complete(self)
end
end
::IOPromise::ExecutorContext.current.register(self) unless @response.nil?
end
|
Class Method Details
.parallel_manager ⇒ Object
Instance Method Details
#execute_pool ⇒ Object
37
38
39
|
# File 'lib/iopromise/faraday/promise.rb', line 37
def execute_pool
FaradayExecutorPool.for(Thread.current)
end
|
#wait ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/iopromise/faraday/promise.rb', line 29
def wait
if @response.nil?
super
else
::IOPromise::ExecutorContext.current.wait_for_all_data(end_when_complete: self)
end
end
|