Class: Natour::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/natour/config.rb

Class Method Summary collapse

Class Method Details

.load_files(filenames, default: {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/natour/config.rb', line 7

def self.load_files(filenames, default: {})
  configs = filenames.map do |filename|
    config = YAML.safe_load(File.read(filename), permitted_classes: [Symbol])
    config || {}
  rescue Errno::ENOENT
    {}
  end
  configs.reduce(default) { |dst, src| dst.deeper_merge!(src, overwrite_arrays: true) }
end