module Refinery
  module SettingsInitializer
    class Loader
      attr_reader :settings

      def initialize(settings)
        @settings = settings
      end

      def load
        @settings.map do |scope, settings|
          settings.map do |name, value|
            [name, value.merge({:scoping => scope})]
          end
        end.flatten(1).each do |setting|
          RefinerySetting.set(setting.first, setting.last)
        end
      end
    end
  end
end


module Refinery
  module SettingsInitializer
    class Loader
      attr_reader :settings

      def initialize(settings)
        @settings = settings
      end

      def load
        @settings.map do |scope, settings|
          settings.map do |name, value|
            [name, transform_value(value, scope)]
          end
        end.flatten(1).each do |setting|
          RefinerySetting.set(setting.first, setting.last)
        end
      end

      private
      def transform_value(value, scope)
        value = symbolize_keys(value)
        scope == 'unscoped' ? value : value.merge({:scoping => scope})
      end

      def symbolize_keys(value)
        Hash[value.map{|k, v| [k.to_sym, v]}]
      end

    end
  end
end


Fix issue converting from strings in YAML settings file to symbols expected by RefinerySetting logic.
Fix issue converting from strings in YAML settings file to symbols expected by RefinerySetting logic.
