Class: RubyLsp::MessageWriter
- Inherits:
-
Object
- Object
- RubyLsp::MessageWriter
- Defined in:
- lib/ruby_lsp/utils.rb
Overview
Writes JSON RPC messages to the given IO
Instance Method Summary collapse
-
#initialize(io) ⇒ MessageWriter
constructor
: (IO) -> void.
-
#write(message) ⇒ Object
: (Hash[Symbol, untyped]) -> void.
Constructor Details
#initialize(io) ⇒ MessageWriter
: (IO) -> void
328 329 330 |
# File 'lib/ruby_lsp/utils.rb', line 328 def initialize(io) @io = io end |
Instance Method Details
#write(message) ⇒ Object
: (Hash[Symbol, untyped]) -> void
333 334 335 336 337 338 339 |
# File 'lib/ruby_lsp/utils.rb', line 333 def write() [:jsonrpc] = "2.0" = .to_json @io.write("Content-Length: #{json_message.bytesize}\r\n\r\n#{json_message}") @io.flush end |