Class: LLM::Function::Sequential::Task
- Defined in:
- lib/llm/function/sequential/task.rb
Overview
The Task class wraps a single direct function call behind the same task-like interface used by spawned concurrency modes.
Instance Attribute Summary
Attributes inherited from Task
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #group_class ⇒ Class
-
#initialize(fn, options = {}) ⇒ Task
constructor
A new instance of Task.
- #interrupt! ⇒ nil (also: #cancel!)
- #spawn ⇒ nil
- #wait ⇒ LLM::Function::Return (also: #value)
Constructor Details
#initialize(fn, options = {}) ⇒ Task
Returns a new instance of Task.
12 13 14 |
# File 'lib/llm/function/sequential/task.rb', line 12 def initialize(fn, = {}) @function = fn end |
Instance Method Details
#alive? ⇒ Boolean
24 25 26 |
# File 'lib/llm/function/sequential/task.rb', line 24 def alive? false end |
#group_class ⇒ Class
45 46 47 |
# File 'lib/llm/function/sequential/task.rb', line 45 def group_class LLM::Function::Sequential::Group end |
#interrupt! ⇒ nil Also known as: cancel!
30 31 32 33 |
# File 'lib/llm/function/sequential/task.rb', line 30 def interrupt! function.interrupt! nil end |
#spawn ⇒ nil
18 19 20 |
# File 'lib/llm/function/sequential/task.rb', line 18 def spawn # no-op — execution happens in wait end |
#wait ⇒ LLM::Function::Return Also known as: value
38 39 40 |
# File 'lib/llm/function/sequential/task.rb', line 38 def wait @result ||= function.call end |