Class: Async::Cancel::Later

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

Overview

Used to defer cancelling the current task until later.

Instance Method Summary collapse

Constructor Details

#initialize(task, cause = nil) ⇒ Later

Create a new cancel later operation.



64
65
66
67
# File 'lib/async/cancel.rb', line 64

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

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/async/cancel.rb', line 70

def alive?
	true
end

#transferObject

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



75
76
77
# File 'lib/async/cancel.rb', line 75

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