class ComplexConfig::Settings

def pathes(hash = table, path_sep: ?., prefix: name_prefix.to_s, result: {})

def pathes(hash = table, path_sep: ?., prefix: name_prefix.to_s, result: {})
  hash.each do |key, value|
    path = prefix.empty? ? key.to_s : "#{prefix}#{path_sep}#{key}"
    case value
    when ::ComplexConfig::Settings
      pathes(
        value,
        path_sep: path_sep,
        prefix:   path,
        result:   result
      )
    when ::Array
      value.each_with_index do |v, i|
        sub_path = path + "[#{i}]"
        if ::ComplexConfig::Settings === v
          pathes(
            v,
            path_sep: path_sep,
            prefix:   sub_path,
            result:   result
          )
        else
          result[sub_path] = v
        end
      end
    else
      result[path] = value
    end
  end
  result
end