~singpolyma/sgx-jmp

ref: 4be555de103e992ee7e03feb48b45c1eca917c45 sgx-jmp/lib/em.rb -rw-r--r-- 246 bytes
4be555deStephen Paul Weber Split logic out into testable objects 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

require "em_promise"

module EM
	def self.promise_defer(klass: EMPromise, &block)
		promise = klass.new
		EventMachine.defer(
			block,
			promise.method(:fulfill),
			promise.method(:reject)
		)
		promise
	end
end