Sha256: 27fdd3c133560670d26570336fbe0f4df6115e9a58f72f974b51347519ce839c
Contents?: true
Size: 562 Bytes
Versions: 7
Compression:
Stored size: 562 Bytes
Contents
module YamlConfigurator def self.config_for(name, env) yaml = Pathname.new("config/#{name}.yml") #puts "Loading #{name} for environment: #{env}" if yaml.exist? require "erb" (YAML.load(ERB.new(yaml.read).result) || {})[env] || {} else raise "Could not load configuration. No such file - #{yaml}" end rescue Psych::SyntaxError => e raise "YAML syntax error occurred while parsing #{yaml}. " "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " "Error: #{e.message}" end end
Version data entries
7 entries across 7 versions & 1 rubygems