Class: Testcloud::Config::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/testcloud/config/manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ Manager

Returns a new instance of Manager.



8
9
10
# File 'lib/testcloud/config/manager.rb', line 8

def initialize(options = {}, &block)
  setup(options, &block)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



6
7
8
# File 'lib/testcloud/config/manager.rb', line 6

def configuration
  @configuration
end

#loaderObject (readonly)

Returns the value of attribute loader.



6
7
8
# File 'lib/testcloud/config/manager.rb', line 6

def loader
  @loader
end

#settingsObject (readonly)

Returns the value of attribute settings.



6
7
8
# File 'lib/testcloud/config/manager.rb', line 6

def settings
  @settings
end

Instance Method Details

#load!Object Also known as: reload!



12
13
14
15
16
# File 'lib/testcloud/config/manager.rb', line 12

def load!
  @configuration = nil
  @configuration = loader.load_configuration
  set_config_constant!(@configuration) if settings.config_classname?
end

#setup(options = {}) {|@settings| ... } ⇒ Object

Yields:



20
21
22
23
24
25
# File 'lib/testcloud/config/manager.rb', line 20

def setup(options = {}, &block)
  @settings = Settings.new(options)
  yield(@settings) if block_given?
  @loader = Loader.new(@settings)
  load! if settings.eager_load?
end