Method: Libuv::Q::Deferred#resolve
- Defined in:
- lib/libuv/q.rb
#resolve(val = nil) ⇒ Object
resolves the derived promise with the value. If the value is a rejection constructed via Q.reject, the promise will be rejected instead.
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/libuv/q.rb', line 242 def resolve(val = nil) @reactor.schedule do if not @pending.nil? callbacks = @pending @pending = nil @reference = ref(@reactor, val) if callbacks.length > 0 callbacks.each do |callback| @reference.then(callback[0], callback[1], callback[2]) end end end end self end |