class
Opal::Async::Worker
- Opal::Async::Worker
- Reference
- Object
Overview
Background asynchronous worker fiber inspired by Python Textual Workers. Executes long-running tasks concurrently without blocking terminal rendering or freezing input.
Defined in:
opal/async/worker.crConstructors
Instance Method Summary
-
#cancel : self
Requests worker cancellation
- #cancelled? : Bool
- #error : Exception | Nil
- #name : String
- #on_complete(&block : -> Nil) : self
- #on_error(&block : Exception -> Nil) : self
- #on_progress(&block : Float64 -> Nil) : self
- #progress : Float64
-
#report_progress(p : Float64) : Nil
Called by the worker block to report incremental completion percentage (0.0 to 1.0)
- #result : String | Int32 | Int64 | Float64 | Bool | Nil
-
#start : self
Spawns background execution fiber
- #state : WorkerState
Constructor Detail
def self.new(name : String = "worker", &work : Worker -> String | Int32 | Int64 | Float64 | Bool | Nil)
#
Instance Method Detail
def report_progress(p : Float64) : Nil
#
Called by the worker block to report incremental completion percentage (0.0 to 1.0)