Class: SolidLoop::Mcp::StdioTransport::Diagnostics

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_loop/mcp/stdio_transport.rb

Overview

Mutex-guarded string buffer: the stderr drain thread and the stdout reader append concurrently (safe under the GVL, undefined elsewhere).

Instance Method Summary collapse

Constructor Details

#initializeDiagnostics

Returns a new instance of Diagnostics.



28
29
30
31
# File 'lib/solid_loop/mcp/stdio_transport.rb', line 28

def initialize
  @mutex = Mutex.new
  @buffer = +""
end

Instance Method Details

#<<(text) ⇒ Object



33
34
35
36
# File 'lib/solid_loop/mcp/stdio_transport.rb', line 33

def <<(text)
  @mutex.synchronize { @buffer << text }
  self
end

#to_sObject



38
39
40
# File 'lib/solid_loop/mcp/stdio_transport.rb', line 38

def to_s
  @mutex.synchronize { @buffer.dup }
end