123456789_123456789_123456789_123456789_123456789_

Class: Mongo::Socket::Unix Private

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Socket
Instance Chain:
self, Socket
Inherits: Socket
  • Object
Defined in: lib/mongo/socket/unix.rb

Overview

Wrapper for Unix sockets.

Since:

  • 2.0.0

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(path, timeout, options = {}) ⇒ Unix

Initializes a new Unix socket.

Examples:

Create the Unix socket.

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

Parameters:

  • path (String)

    The path.

  • timeout (Float)

    The socket timeout value.

  • options (Hash) (defaults to: {})

    The options.

Options Hash (options):

  • :connect_timeout (Float)

    Connect timeout (unused).

  • :connection_address (Address)

    ::Mongo::Address of the connection that created this socket.

  • :connection_generation (Integer)

    Generation of the connection (for non-monitoring connections) that created this socket.

  • :monitor (true | false)

    Whether this socket was created by a monitoring connection.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/socket/unix.rb', line 42

def initialize(path, timeout, options = {})
  super(timeout, options)
  @path = path
  @socket = ::UNIXSocket.new(path)
  set_socket_options(@socket)
end

Instance Attribute Details

#pathString (readonly)

Returns:

  • (String)

    path The path to connect to.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/socket/unix.rb', line 50

attr_reader :path

Instance Method Details

#human_address (private)

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/socket/unix.rb', line 54

def human_address
  path
end