Class: Refinery::SettingsInitializer::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/refinery/settings_initializer/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Loader

Returns a new instance of Loader.



6
7
8
# File 'lib/refinery/settings_initializer/loader.rb', line 6

def initialize(settings)
  @settings = settings
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



4
5
6
# File 'lib/refinery/settings_initializer/loader.rb', line 4

def settings
  @settings
end

Instance Method Details

#loadObject



10
11
12
13
14
15
16
17
18
# File 'lib/refinery/settings_initializer/loader.rb', line 10

def load
  settings.map do |scope, children|
    children.map do |name, value|
      [name, transform_value(value, scope)]
    end
  end.flatten(1).each do |name, options|
    RefinerySetting.set(name, options)
  end
end