Sha256: 154c381f77b7d959d1eaa387e076fd982ea6e48a93ee204dc30ae1fe97a929b7

Contents?: true

Size: 663 Bytes

Versions: 106

Compression:

Stored size: 663 Bytes

Contents

module LanguageServer
  module Protocol
    module Transport
      module Io
        class Writer
          attr_reader :io

          def initialize(io)
            @io = io
            io.binmode
          end

          def write(response)
            response_str = response.merge(
              jsonrpc: "2.0"
            ).to_json

            headers = {
              "Content-Length" => response_str.bytesize
            }

            headers.each do |k, v|
              io.print "#{k}: #{v}\r\n"
            end

            io.print "\r\n"

            io.print response_str
            io.flush
          end
        end
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 13 rubygems

Version Path
harbr-0.1.63 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.62 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.61 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.60 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.59 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.58 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.57 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.56 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.55 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.54 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.53 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.52 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.49 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.48 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.47 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.46 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.45 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.44 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.1.43 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb