3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/dharma/future.rb', line 3
def self.call(body, executor)
promise = Dharma.promise
work = proc do
begin
promise.success(body.call)
rescue => e
promise.failure(e)
end
end
executor.execute(work)
promise
end
|