Sha256: 362e2f6fce634433dd70800918e5e2969844d21f34fcf121541de84f858ee039

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

require 'puppet_editor_services/connection/base'

module PuppetEditorServices
  module Connection
    class Tcp < ::PuppetEditorServices::Connection::Base
      attr_accessor :socket

      def initialize(server, socket)
        super(server)
        @socket = socket
      end

      def send_data(data)
        return false if socket.nil?

        socket.write(data)
        true
      end

      def close_after_writing
        socket.flush unless socket.nil?
        server.remove_connection_async(socket)
        true
      end

      def close
        server.remove_connection_async(socket)
        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-editor-services-2.0.4 lib/puppet_editor_services/connection/tcp.rb