lib/monetdb/connection.rb in monetdb-0.2.3 vs lib/monetdb/connection.rb in monetdb-0.2.4

- old
+ new

@@ -61,16 +61,24 @@ @socket = TCPSocket.new config[:host], config[:port].to_i setup true end + def disconnect + socket.disconnect if connected? + @socket = nil + end + def connected? !socket.nil? end - def disconnect - socket.disconnect if connected? - @socket = nil + def reconnect? + !!config[:reconnect] + end + + def check_connectivity! + connect if reconnect? && !connected? end private def config