class ThomasUtils::FutureWrapper
Public Class Methods
new(future, &callback)
click to toggle source
# File lib/thomas_utils/future_wrapper.rb, line 8 def initialize(future, &callback) @future = future @callback = callback end
Public Instance Methods
get()
click to toggle source
# File lib/thomas_utils/future_wrapper.rb, line 13 def get @result ||= @callback.call(@future.get) end
on_success() { |call| ... }
click to toggle source
# File lib/thomas_utils/future_wrapper.rb, line 17 def on_success @future.on_success { |result| yield @callback.call(result) } end