Class: MCP::Server::Stdio::Writer
- Inherits:
-
Object
- Object
- MCP::Server::Stdio::Writer
- Defined in:
- lib/mcp/server/stdio/writer.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(io = STDOUT) ⇒ Writer
constructor
A new instance of Writer.
- #write(response) ⇒ Object
Constructor Details
#initialize(io = STDOUT) ⇒ Writer
Returns a new instance of Writer.
11 12 13 14 |
# File 'lib/mcp/server/stdio/writer.rb', line 11 def initialize(io = STDOUT) @io = io io.binmode end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
9 10 11 |
# File 'lib/mcp/server/stdio/writer.rb', line 9 def io @io end |
Instance Method Details
#close ⇒ Object
21 22 23 |
# File 'lib/mcp/server/stdio/writer.rb', line 21 def close io.close end |
#write(response) ⇒ Object
16 17 18 19 |
# File 'lib/mcp/server/stdio/writer.rb', line 16 def write(response) response_str = response.to_json io.puts response_str end |