class Mongo::Address::Unix
Sets up socket addresses.
@since 2.0.0
Constants
- MATCH
The regular expression to use to match a socket path.
@since 2.0.0
Attributes
@return [ String ] host The host.
@return [ nil ] port Will always be nil.
Public Class Methods
Initialize the socket resolver.
@example Initialize the resolver.
Unix.new("/path/to/socket.sock", "/path/to/socket.sock")
@param [ String ] host The host.
@since 2.0.0
# File lib/mongo/address/unix.rb, line 56 def initialize(host, port=nil, host_name=nil) @host = host end
Parse a socket path.
@example Parse the address.
Unix.parse("/path/to/socket.sock")
@param [ String ] address The address to parse.
@return [ Array<String> ] A list with the host (socket path).
@since 2.0.0
# File lib/mongo/address/unix.rb, line 44 def self.parse(address) [ address ] end
Public Instance Methods
Get a socket for the provided address type, given the options.
@example Get a Unix
socket.
address.socket(5)
@param [ Float ] socket_timeout The socket timeout. @param [ Hash ] ssl_options SSL options - ignored. @param [ Hash ] options The options.
@option options [ Float ] :connect_timeout Connect timeout.
@return [ Mongo::Socket::Unix
] The socket.
@since 2.0.0
# File lib/mongo/address/unix.rb, line 74 def socket(socket_timeout, ssl_options = {}, options = {}) Socket::Unix.new(host, socket_timeout, options) end