class OpsDeploy::Waiter
A class defining a generic 'waiter' thread that waits for tasks to finish
Attributes
callback[RW]
data[RW]
end_when[RW]
Public Class Methods
new(&task)
click to toggle source
Calls superclass method
# File lib/ops_deploy/waiter.rb, line 5 def initialize(&task) @task = task super() do error = nil begin loop do @data = @task.call break if @end_when.call(@data) sleep 5 end rescue StandardError => e error = e end @callback.call(@data, error) if @callback @data end end