Class: Proxy::RemoteExecution::Cockpit::BufferedSocket
- Inherits:
-
Object
- Object
- Proxy::RemoteExecution::Cockpit::BufferedSocket
- Extended by:
- Forwardable
- Includes:
- NetSSHCompat::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
Direct Known Subclasses
MiniSSLBufferedSocket, OpenSSLBufferedSocket, StandardBufferedSocket
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(socket) ⇒ BufferedSocket
constructor
A new instance of BufferedSocket.
- #recv ⇒ Object
- #send ⇒ Object
Methods included from NetSSHCompat::BufferedIO
#available, #enqueue, #fill, #pending_writes?, #read_available, #send_pending, #wait_for_pending_sends
Constructor Details
#initialize(socket) ⇒ BufferedSocket
Returns a new instance of BufferedSocket.
16 17 18 19 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 16 def initialize(socket) @socket = socket initialize_buffered_io end |
Class Method Details
.applies_for?(socket) ⇒ Boolean
29 30 31 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 29 def self.applies_for?(socket) raise NotImplementedError end |
.build(socket) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 33 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
#recv ⇒ Object
21 22 23 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 21 def recv raise NotImplementedError end |
#send ⇒ Object
25 26 27 |
# File 'lib/smart_proxy_remote_execution_ssh/cockpit.rb', line 25 def send raise NotImplementedError end |