~singpolyma/sgx-jmp

sgx-jmp/lib/promise_hash.rb -rw-r--r-- 205 bytes
4ace3417Stephen Paul Weber Log errors from rev.ai 8 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

require "em_promise"

module PromiseHash
	def self.all(**kwargs)
		keys = kwargs.keys
		EMPromise.all(kwargs.values).then { |results|
			Hash[keys.zip(results)]
		}
	end
end