class Futurist::Future

Attributes

resolution_strategy[R]

Public Class Methods

new(resolution_strategy: ForkingResolutionStrategy, &block) click to toggle source
# File lib/futurist/future.rb, line 3
def initialize(resolution_strategy: ForkingResolutionStrategy,
               &block)
  promise = Futurist::Promise.new(callable: block)
  @resolution_strategy = resolution_strategy.new(promise: promise)
end

Public Instance Methods

ready?() click to toggle source
# File lib/futurist/future.rb, line 13
def ready?
  resolution_strategy.resolved?
end
value() click to toggle source
# File lib/futurist/future.rb, line 9
def value
  @value ||= resolution_strategy.resolve
end