Class: Docker::API::Transport::Base Abstract
- Inherits:
-
Object
- Object
- Docker::API::Transport::Base
- Defined in:
- lib/docker/api/transport/base.rb
Overview
This class is abstract.
Subclass and implement #connect.
The contract every transport honours: make a socket, say what Host header requests over it should carry, and describe yourself for logs.
Transports know how to dial, and nothing else. Keeping them this narrow is what makes the layer above testable -- Fake is a drop-in because there is so little to stand in for.
Instance Method Summary collapse
-
#connect ⇒ IO
Open a connection.
-
#host_header ⇒ String
The daemon does not route on Host, but HTTP/1.1 requires the header and some proxies in front of a daemon do care.
-
#to_s ⇒ String
(also: #inspect)
A description safe to put in a log line.
Instance Method Details
#connect ⇒ IO
Open a connection.
22 23 24 |
# File 'lib/docker/api/transport/base.rb', line 22 def connect raise NotImplementedError, "#{self.class} must implement #connect" end |
#host_header ⇒ String
The daemon does not route on Host, but HTTP/1.1 requires the header and some proxies in front of a daemon do care.
30 31 32 |
# File 'lib/docker/api/transport/base.rb', line 30 def host_header "localhost" end |
#to_s ⇒ String Also known as: inspect
Returns a description safe to put in a log line.
35 36 37 |
# File 'lib/docker/api/transport/base.rb', line 35 def to_s "#<#{self.class.name}>" end |