Class: Mongo::Address::Unix
- Inherits:
-
Object
- Object
- Mongo::Address::Unix
- Defined in:
- lib/mongo/address/unix.rb
Overview
Sets up socket addresses.
Constant Summary collapse
- MATCH =
The regular expression to use to match a socket path.
Regexp.new('\.sock').freeze
Instance Attribute Summary collapse
-
#host ⇒ String
readonly
Host The host.
-
#port ⇒ nil
readonly
Port Will always be nil.
Class Method Summary collapse
-
.parse(address) ⇒ Array<String>
Parse a socket path.
Instance Method Summary collapse
-
#initialize(host, port = nil, host_name = nil) ⇒ Unix
constructor
Initialize the socket resolver.
-
#socket(socket_timeout, options = {}) ⇒ Mongo::Socket::Unix
private
Get a socket for the provided address type, given the options.
Constructor Details
#initialize(host, port = nil, host_name = nil) ⇒ Unix
Initialize the socket resolver.
59 60 61 |
# File 'lib/mongo/address/unix.rb', line 59 def initialize(host, port=nil, host_name=nil) @host = host end |
Instance Attribute Details
#host ⇒ String (readonly)
Returns host The host.
27 28 29 |
# File 'lib/mongo/address/unix.rb', line 27 def host @host end |
#port ⇒ nil (readonly)
Returns port Will always be nil.
30 31 32 |
# File 'lib/mongo/address/unix.rb', line 30 def port @port end |
Class Method Details
.parse(address) ⇒ Array<String>
Parse a socket path.
47 48 49 |
# File 'lib/mongo/address/unix.rb', line 47 def self.parse(address) [ address ] end |
Instance Method Details
#socket(socket_timeout, options = {}) ⇒ Mongo::Socket::Unix
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get a socket for the provided address type, given the options.
77 78 79 |
# File 'lib/mongo/address/unix.rb', line 77 def socket(socket_timeout, = {}) Socket::Unix.new(host, socket_timeout, ) end |