class Dry::System::Settings::Configuration
Public Class Methods
init(root, env)
click to toggle source
# File lib/dry/system/settings.rb, line 42 def self.init(root, env) env_data = load_files(root, env) attributes = {} errors = {} schema.each do |key| value = ENV.fetch(key.name.to_s.upcase) { env_data[key.name.to_s.upcase] } type_check = key.try(value || Undefined) attributes[key.name] = value if value errors[key] = type_check if type_check.failure? end raise InvalidSettingsError, errors unless errors.empty? new(attributes) end
setting(*args)
click to toggle source
# File lib/dry/system/settings.rb, line 38 def self.setting(*args) attribute(*args) end
Private Class Methods
load_files(root, env)
click to toggle source
# File lib/dry/system/settings.rb, line 60 def self.load_files(root, env) FileLoader.new.(root, env) end