Class: Proxy::RemoteExecution::Cockpit::BufferedSocket

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Net::SSH::BufferedIo
Defined in:
lib/smart_proxy_remote_execution_ssh/cockpit.rb

Overview

A wrapper class around different kind of sockets to comply with Net::SSH event loop

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(socket) ⇒ BufferedSocket

Returns a new instance of BufferedSocket.



15
16
17
18
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 15

def initialize(socket)
  @socket = socket
  initialize_buffered_io
end

Class Method Details

.applies_for?(socket) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 28

def self.applies_for?(socket)
  raise NotImplementedError
end

.build(socket) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 32

def self.build(socket)
  klass = [OpenSSLBufferedSocket, MiniSSLBufferedSocket, StandardBufferedSocket].find do |potential_class|
    potential_class.applies_for?(socket)
  end
  raise "No suitable implementation of buffered socket available for #{socket.inspect}" unless klass
  klass.new(socket)
end

Instance Method Details

#recvObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 20

def recv
  raise NotImplementedError
end

#sendObject

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 24

def send
  raise NotImplementedError
end