Method: APromise#resolve
- Defined in:
- lib/apromise.rb
#resolve(value: nil, task: nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/apromise.rb', line 46 def resolve(value: nil, task: nil) @value = value if (block_given?) begin @value = yield rescue Exception => e @value = e end end reactor = (task ||= Async::Task.current).reactor reactor << Async::Notification::Signal.new(@waiting, @value) reactor.yield @waiting = [ ] nil end |