Module: Redshift::Client::ConnectionHandling
- Included in:
- Redshift::Client
- Defined in:
- lib/redshift/client/connection_handling.rb
Instance Method Summary collapse
- #connected? ⇒ Boolean
- #connection ⇒ Object
- #disconnect ⇒ Object
- #establish_connection(config = {}) ⇒ Object
- #established? ⇒ Boolean
Instance Method Details
#connected? ⇒ Boolean
20 21 22 |
# File 'lib/redshift/client/connection_handling.rb', line 20 def connected? !!(thread && thread[:connection]) end |
#connection ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/redshift/client/connection_handling.rb', line 28 def connection raise ConnectionNotEstablished.new unless established? if connected? thread[:connection] else connect! end end |
#disconnect ⇒ Object
13 14 15 16 17 18 |
# File 'lib/redshift/client/connection_handling.rb', line 13 def disconnect if connected? connection.finish cleanup! end end |
#establish_connection(config = {}) ⇒ Object
7 8 9 10 11 |
# File 'lib/redshift/client/connection_handling.rb', line 7 def establish_connection(config = {}) disconnect initialize_thread! configure!(config) end |
#established? ⇒ Boolean
24 25 26 |
# File 'lib/redshift/client/connection_handling.rb', line 24 def established? !!(thread && thread[:configurations]) end |