Class: Praxis::BootloaderStages::PluginConfigLoad

Inherits:
Stage
  • Object
show all
Defined in:
lib/praxis/bootloader_stages/plugin_config_load.rb

Instance Attribute Summary

Attributes inherited from Stage

#after_callbacks, #before_callbacks, #context, #name, #stages

Instance Method Summary collapse

Methods inherited from Stage

#after, #application, #before, #callback_args, #execute_callbacks, #initialize, #run, #setup!, #setup_deferred_callbacks!

Constructor Details

This class inherits a constructor from Praxis::Stage

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/praxis/bootloader_stages/plugin_config_load.rb', line 5

def execute
  application.plugins.each do |config_key, plugin|
    context = [plugin.class.name]
    value = plugin.load_config!
    object = plugin.config_attribute.load(value, context)

    if object
      application.config.send("#{config_key}=", object)
    end

    plugin.config = application.config.send("#{config_key}")
  end
end