14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/contingency.rb', line 14
def self.configure
self.adapters = Contingency::Adapters.constants.reject{ |a| a == :Interface }
unless self.adapter
if self.adapters.length > 0
self.adapter = Contingency::Adapters.const_get self.adapters.first
else
self.adapter = Adapters::Interface
end
end
self.configuration ||= defined?(self.adapter::Configuration) ? self.adapter::Configuration.new : Configuration.new
yield(configuration) if block_given?
require "contingency/plan"
configuration
end
|