Class: Docker::API::Transport::Unix
- Defined in:
- lib/docker/api/transport/unix.rb
Overview
A daemon reached over a unix domain socket, which is how Docker is reached on Linux and macOS by default.
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The socket path.
Instance Method Summary collapse
-
#connect ⇒ IO
A connected unix socket.
-
#initialize(path:) ⇒ Unix
constructor
A new instance of Unix.
- #to_s ⇒ String (also: #inspect)
Methods inherited from Base
Constructor Details
#initialize(path:) ⇒ Unix
Returns a new instance of Unix.
16 17 18 19 |
# File 'lib/docker/api/transport/unix.rb', line 16 def initialize(path:) super() @path = path end |
Instance Attribute Details
#path ⇒ String (readonly)
Returns the socket path.
13 14 15 |
# File 'lib/docker/api/transport/unix.rb', line 13 def path @path end |
Instance Method Details
#connect ⇒ IO
Returns a connected unix socket.
23 24 25 |
# File 'lib/docker/api/transport/unix.rb', line 23 def connect dial("unix://#{path}") { UNIXSocket.new(path) } end |
#to_s ⇒ String Also known as: inspect
28 29 30 |
# File 'lib/docker/api/transport/unix.rb', line 28 def to_s "#<Docker::API::Transport::Unix path=#{path}>" end |