Class: Async::Stop::Later

Inherits:
Object
  • Object
show all
Defined in:
lib/async/stop.rb

Overview

Used to defer stopping the current task until later.

Instance Method Summary collapse

Constructor Details

#initialize(task, cause = nil) ⇒ Later

Create a new stop later operation.



66
67
68
69
# File 'lib/async/stop.rb', line 66

def initialize(task, cause = nil)
  @task = task
  @cause = cause
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/async/stop.rb', line 72

def alive?
  true
end

#transferObject

Transfer control to the operation - this will stop the task.



77
78
79
# File 'lib/async/stop.rb', line 77

def transfer
  @task.stop(false, cause: @cause)
end