Class: FutureProof::Future

Inherits:
Object
  • Object
show all
Defined in:
lib/future_proof/future.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Future

Returns a new instance of Future.



3
4
5
# File 'lib/future_proof/future.rb', line 3

def initialize(&block)
  @block = block
end

Instance Method Details

#call(*args) ⇒ Object



7
8
9
# File 'lib/future_proof/future.rb', line 7

def call(*args)
  thread(*args)
end

#complete?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/future_proof/future.rb', line 15

def complete?
  !thread.alive?
end

#value(*args) ⇒ Object



11
12
13
# File 'lib/future_proof/future.rb', line 11

def value(*args)
  thread(*args).value
end