Class: HammerCLI::Connection
- Inherits:
-
Object
- Object
- HammerCLI::Connection
- Defined in:
- lib/hammer_cli/connection.rb
Class Method Summary collapse
- .create(name, conector_params = {}, options = {}) ⇒ Object
- .drop(name) ⇒ Object
- .drop_all ⇒ Object
- .exist?(name) ⇒ Boolean
- .get(name) ⇒ Object
Class Method Details
.create(name, conector_params = {}, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/hammer_cli/connection.rb', line 18 def self.create(name, conector_params={}, ={}) unless connections[name] Logging.logger['Connection'].debug "Registered: #{name}" connector = [:connector] || AbstractConnector connections[name] = connector.new(conector_params) end connections[name] end |
.drop(name) ⇒ Object
10 11 12 |
# File 'lib/hammer_cli/connection.rb', line 10 def self.drop(name) connections.delete(name) end |
.drop_all ⇒ Object
14 15 16 |
# File 'lib/hammer_cli/connection.rb', line 14 def self.drop_all() connections.keys.each { |c| drop(c) } end |
.exist?(name) ⇒ Boolean
28 29 30 |
# File 'lib/hammer_cli/connection.rb', line 28 def self.exist?(name) !get(name).nil? end |
.get(name) ⇒ Object
32 33 34 |
# File 'lib/hammer_cli/connection.rb', line 32 def self.get(name) connections[name] end |