Class: ConnectionFactory
- Inherits:
-
Object
- Object
- ConnectionFactory
- Defined in:
- lib/audit/lib/connection/connection_factory.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
-
#initialize(options) ⇒ ConnectionFactory
constructor
A new instance of ConnectionFactory.
Constructor Details
#initialize(options) ⇒ ConnectionFactory
Returns a new instance of ConnectionFactory.
5 6 7 8 9 10 11 |
# File 'lib/audit/lib/connection/connection_factory.rb', line 5 def initialize() if [:logger] then @logger = [:logger] else @logger = Logger.new(STDOUT) end end |
Instance Method Details
#create(options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/audit/lib/connection/connection_factory.rb', line 13 def create() raise "Need option :connection_type" unless [:connection_type] raise "Need option :connection_params" unless [:connection_params] case [:connection_type] when :ssh return SshConnection.new({:connection_params => [:connection_params], :logger => @logger}) when :ami return AmiConnection.new({:connection_params => [:connection_params], :logger => @logger}) else raise "Unknown connection type" end end |