Class: Persey::Adapters::Yaml
Class Method Summary collapse
Methods inherited from Base
config_exists?, symbolize_keys
Class Method Details
.load(file, _env, opts: {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/persey/adapters/yaml.rb', line 12 def load(file, _env, opts: {}) raw_hash = YAML.load(ERB.new(File.read(file)).result) symbolize_keys(raw_hash) rescue KeyError => e _, line, method = /\(erb\):(\d+):in `(.*)'/.match(e.backtrace[0]).to_a if method == 'fetch' raise MissingEnvVariable.new("Check line ##{line} in #{file}") else raise e end end |