lib/mongo/socket/unix.rb in mongo-2.2.4 vs lib/mongo/socket/unix.rb in mongo-2.2.5

- old
+ new

@@ -53,9 +53,21 @@ def initialize(path, timeout) @path, @timeout = path, timeout @socket = ::UNIXSocket.new(path) set_socket_options(@socket) end + + # 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 + def connectable? + !!@socket + end end end end