class TypeProf::LSP::Writer

公共类方法

new(io) 点击以切换源代码
# File typeprof-0.30.1/lib/typeprof/lsp/server.rb, line 190
def initialize(io)
  @io = io
  @mutex = Mutex.new
end

公共实例方法

write(**json) 点击以切换源代码
# File typeprof-0.30.1/lib/typeprof/lsp/server.rb, line 195
def write(**json)
  json = JSON.generate(json.merge(jsonrpc: "2.0"))
  @mutex.synchronize do
    @io << "Content-Length: #{ json.bytesize }\r\n\r\n" << json
    @io.flush
  end
end