Method: EasySettings::PathSource#load

Defined in:
lib/easy-settings/path_source.rb

#loadObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/easy-settings/path_source.rb', line 14

def load
  {}.tap do |data|
    Dir["#{base_path}/*"].each do |path|
      next unless File.file?(path)

      variable = path.gsub("#{base_path}/", "")
      keys = settings_root + variable.to_s.split(separator)
      value = File.binread(path).strip
      assign_value(data, keys, value)
    end
  end
end