Class: GitMulticast::TaskRunner::PoorMansFuture

Inherits:
Object
  • Object
show all
Defined in:
lib/git_multicast/task_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ PoorMansFuture

Returns a new instance of PoorMansFuture.



26
27
28
29
30
# File 'lib/git_multicast/task_runner.rb', line 26

def initialize(&block)
  @thread = Thread.new do
    Thread.current[:output] = block.call
  end
end

Instance Attribute Details

#threadObject (readonly)

Returns the value of attribute thread.



37
38
39
# File 'lib/git_multicast/task_runner.rb', line 37

def thread
  @thread
end

Instance Method Details

#getObject



32
33
34
35
# File 'lib/git_multicast/task_runner.rb', line 32

def get
  thread.join
  thread[:output]
end