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
connectable?()
click to toggle source
This socket can only be used if the unix socket (@socket) has been created.
@example Is the socket connectable?
socket.connectable?
@return [ true, false ] If the socket is connectable.
@since 2.2.5
# File lib/mongo/socket/unix.rb, line 67 def connectable? !!@socket end