class HammerCLI::Connection

Public Class Methods

create(name, conector_params={}, options={}) click to toggle source
# File lib/hammer_cli/connection.rb, line 18
def self.create(name, conector_params={}, options={})
  unless connections[name]
    Logging.logger['Connection'].debug "Registered: #{name}"
    connector = options[:connector] || AbstractConnector

    connections[name] = connector.new(conector_params)
  end
  connections[name]
end
drop(name) click to toggle source
# File lib/hammer_cli/connection.rb, line 10
def self.drop(name)
  connections.delete(name)
end
drop_all() click to toggle source
# File lib/hammer_cli/connection.rb, line 14
def self.drop_all()
  connections.keys.each { |c| drop(c) }
end
exist?(name) click to toggle source
# File lib/hammer_cli/connection.rb, line 28
def self.exist?(name)
  !get(name).nil?
end
get(name) click to toggle source
# File lib/hammer_cli/connection.rb, line 32
def self.get(name)
  connections[name]
end

Private Class Methods

connections() click to toggle source
# File lib/hammer_cli/connection.rb, line 38
def self.connections
  @connections_hash ||= {}
  @connections_hash
end