Class: Persey::Adapters::Yaml
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.load(file, env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/persey/adapters/yaml.rb', line 10 def load(file, env) begin 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 end |