Module: Mongo::Server::Connectable
- Included in:
- Connection, Monitor::Connection
- Defined in:
- lib/mongo/server/connectable.rb
Overview
This provides common behaviour for connection objects.
Constant Summary collapse
- SSL =
The ssl option prefix.
'ssl'.freeze
- TIMEOUT =
Deprecated.
Timeouts on Ruby sockets aren’t effective so this default option is no longer used. Will be removed in driver version 3.0.
The default time in seconds to timeout an operation executed on a socket.
5.freeze
Instance Attribute Summary collapse
-
#address ⇒ Mongo::Address
readonly
Address The address to connect to.
-
#options ⇒ Hash
readonly
Options The passed in options.
-
#pid ⇒ Integer
readonly
Pid The process id when the connection was created.
Instance Method Summary collapse
-
#connectable? ⇒ true, false
deprecated
Deprecated.
No longer necessary with Server Selection specification.
-
#connected? ⇒ true, false
deprecated
Deprecated.
Use #connectable? instead
Instance Attribute Details
#address ⇒ Mongo::Address (readonly)
Returns address The address to connect to.
38 39 40 |
# File 'lib/mongo/server/connectable.rb', line 38 def address @address end |
#options ⇒ Hash (readonly)
Returns options The passed in options.
41 42 43 |
# File 'lib/mongo/server/connectable.rb', line 41 def @options end |
#pid ⇒ Integer (readonly)
Returns pid The process id when the connection was created.
44 45 46 |
# File 'lib/mongo/server/connectable.rb', line 44 def pid @pid end |
Instance Method Details
#connectable? ⇒ true, false
No longer necessary with Server Selection specification.
Determine if the server is connectable. This will check not only if the connection exists, but if messages can send to it successfully.
57 |
# File 'lib/mongo/server/connectable.rb', line 57 def connectable?; end |
#connected? ⇒ true, false
Use #connectable? instead
Determine if the connection is currently connected.
67 68 69 |
# File 'lib/mongo/server/connectable.rb', line 67 def connected? !!@socket && @socket.alive? end |