Class: RgGen::Configuration::ConfigurationFactory

Inherits:
InputBase::ComponentFactory show all
Defined in:
lib/rggen/core_components/configuration/configuration_factory.rb

Instance Attribute Summary

Attributes inherited from InputBase::ComponentFactory

#loaders

Attributes inherited from Base::ComponentFactory

#child_factory, #item_factories, #target_component

Instance Method Summary collapse

Methods inherited from InputBase::ComponentFactory

#create

Methods inherited from Base::ComponentFactory

#create, #initialize, #root_factory

Constructor Details

This class inherits a constructor from RgGen::Base::ComponentFactory

Instance Method Details

#create_active_items(configuration, hash) ⇒ Object



4
5
6
7
8
# File 'lib/rggen/core_components/configuration/configuration_factory.rb', line 4

def create_active_items(configuration, hash)
  active_item_factories.each do |name, factory|
    create_item(factory, configuration, hash[name])
  end
end

#load(file) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rggen/core_components/configuration/configuration_factory.rb', line 10

def load(file)
  return {} if file.nil? || file.empty?

  data  = load_file(file)
  if data.is_a?(Hash)
    data.symbolize_keys!
  else
    message = "Hash type required for configuration: #{data.class}"
    fail RgGen::LoadError, message
  end
end