Sha256: 25e5b0a5175afa403cab80ad3fb5404ff6a7f8f04cb4d75f471ae1f2f09c17c4
Contents?: true
Size: 612 Bytes
Versions: 2
Compression:
Stored size: 612 Bytes
Contents
module PromisePool class Future < BasicObject def self.resolve future if future.kind_of?(::Array) future.map(&method(:resolve)) elsif future.kind_of?(::Hash) future.inject({}) do |r, (k, v)| r[k] = resolve(v) r end else future.itself end end def initialize promise @promise = promise end def method_missing msg, *args, &block @promise.yield.__send__(msg, *args, &block) end def respond_to_missing? msg, *args, &block @promise.yield.respond_to?(msg, *args, &block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
promise_pool-0.9.2 | lib/promise_pool/future.rb |
promise_pool-0.9.1 | lib/promise_pool/future.rb |