Class: Rooibos::Command::Cancel
- Inherits:
-
Object
- Object
- Rooibos::Command::Cancel
- Includes:
- Custom
- Defined in:
- lib/rooibos/command.rb
Overview
Cancels a running command.
Long-running commands (WebSocket listeners, database pollers) run until stopped. Stopping them requires signaling from outside the command. The runtime tracks active commands by their object identity and routes cancel requests.
This type carries the handle (command object) to cancel. The runtime pattern-matches on Command::Cancel and signals the token.
Prefer the Command.cancel factory method for convenience.
Example
# Using the factory method (recommended)
[model, Command.cancel(model.active_fetch)]
# Using the class directly
[model, Cancel.new(handle: model.active_fetch)]
Instance Method Summary collapse
-
#call(_out, _token) ⇒ Object
Stub - Cancel is a sentinel handled by runtime before dispatch.
Methods included from Custom
#deconstruct_keys, #rooibos_cancellation_grace_period, #rooibos_command?
Instance Method Details
#call(_out, _token) ⇒ Object
Stub - Cancel is a sentinel handled by runtime before dispatch.
235 236 237 |
# File 'lib/rooibos/command.rb', line 235 def call(_out, _token) raise "Cancel command should never be dispatched" end |