class Cl::Config::Files

Constants

PATHS

Public Instance Methods

load() click to toggle source
# File lib/cl/config/files.rb, line 14
def load
  configs.any? ? symbolize(merge(*configs)) : {}
end

Private Instance Methods

configs() click to toggle source
# File lib/cl/config/files.rb, line 20
def configs
  @configs ||= paths.map { |path| YAML.load_file(path) || {} }
end
paths() click to toggle source
# File lib/cl/config/files.rb, line 24
def paths
  paths = PATHS.map { |path| File.expand_path(path % name) }
  paths.select { |path| File.exist?(path) }
end
symbolize(hash) click to toggle source
# File lib/cl/config/files.rb, line 29
def symbolize(hash)
  hash.map { |key, value| [key.to_sym, value] }.to_h
end