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.83 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.82 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.81 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.80 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.79 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.78 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.77 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.76 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.75 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.74 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.73 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.72 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.71 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.70 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.69 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.68 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.67 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.66 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.65 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.64 vendor/bundle/ruby/3.2.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/writer.rb