Class: LLM::Function::Sequential::Task

Inherits:
Task
  • Object
show all
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

#function

Instance Method Summary collapse

Constructor Details

#initialize(fn, options = {}) ⇒ Task

Returns a new instance of Task.

Parameters:



12
13
14
# File 'lib/llm/function/sequential/task.rb', line 12

def initialize(fn, options = {})
  @function = fn
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/llm/function/sequential/task.rb', line 24

def alive?
  false
end

#group_classClass

Returns:

  • (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!

Returns:

  • (nil)


30
31
32
33
# File 'lib/llm/function/sequential/task.rb', line 30

def interrupt!
  function.interrupt!
  nil
end

#spawnnil

Returns:

  • (nil)


18
19
20
# File 'lib/llm/function/sequential/task.rb', line 18

def spawn
  # no-op — execution happens in wait
end

#waitLLM::Function::Return Also known as: value



38
39
40
# File 'lib/llm/function/sequential/task.rb', line 38

def wait
  @result ||= function.call
end