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.2.4 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.2.3 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.2.2 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.2.1 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb
harbr-0.2.0 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.99 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.98 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.97 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.96 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.95 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.94 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.93 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.91 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.90 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.89 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.88 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.87 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.86 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.85 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.84 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb