class Mongo::Socket::Unix

Wrapper for Unix sockets.

@since 2.0.0

Attributes

path[R]

@return [ String ] path The path to connect to.

timeout[R]

@return [ Float ] timeout The connection timeout.

Public Class Methods

new(path, timeout) click to toggle source

Initializes a new Unix socket.

@example Create the Unix socket.

Unix.new('/path/to.sock', 5)

@param [ String ] path The path. @param [ Float ] timeout The socket timeout value.

@since 2.0.0

# File lib/mongo/socket/unix.rb, line 53
def initialize(path, timeout)
  @path, @timeout = path, timeout
  @socket = ::UNIXSocket.new(path)
  set_socket_options(@socket)
end

Public Instance Methods

connect!() click to toggle source

Establishes a socket connection.

@example Connect the socket.

sock.connect!

@note This method mutates the object by setting the socket

internally.

@return [ Unix ] The connected socket instance.

@since 2.0.0

# File lib/mongo/socket/unix.rb, line 40
def connect!
  self
end