Class: Ask::Agent::ToolAbortController

Inherits:
Object
  • Object
show all
Defined in:
lib/ask/agent/tool_abort_controller.rb

Instance Method Summary collapse

Constructor Details

#initializeToolAbortController

Returns a new instance of ToolAbortController.



6
7
8
9
# File 'lib/ask/agent/tool_abort_controller.rb', line 6

def initialize
  @aborted = false
  @mutex = Mutex.new
end

Instance Method Details

#abort!Object



11
12
13
# File 'lib/ask/agent/tool_abort_controller.rb', line 11

def abort!
  @mutex.synchronize { @aborted = true }
end

#aborted?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/ask/agent/tool_abort_controller.rb', line 15

def aborted?
  @mutex.synchronize { @aborted }
end

#reset!Object



19
20
21
# File 'lib/ask/agent/tool_abort_controller.rb', line 19

def reset!
  @mutex.synchronize { @aborted = false }
end