Class: Async::Cancel::Later
- Inherits:
-
Object
- Object
- Async::Cancel::Later
- Defined in:
- lib/async/cancel.rb
Overview
Used to defer cancelling the current task until later.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(task, cause = nil) ⇒ Later
constructor
Create a new cancel later operation.
-
#transfer ⇒ Object
Transfer control to the operation - this will cancel the task.
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
70 71 72 |
# File 'lib/async/cancel.rb', line 70 def alive? true end |
#transfer ⇒ Object
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 |