Sha256: 9cc4bacad0255acf3854b9af55b2ba1666d5c8ca3fb4ac1567c2af01c30732b5
Contents?: true
Size: 744 Bytes
Versions: 44
Compression:
Stored size: 744 Bytes
Contents
require 'erb' require 'yaml' class Ridgepole::Config class << self def load(config, env = 'development') parsed_config = if File.exist?(config) parse_config_file(config) else YAML.load(ERB.new(config).result) end unless parsed_config.kind_of?(Hash) config = File.expand_path(config) parse_config = parse_config_file(config) end if parsed_config.has_key?(env.to_s) parsed_config.fetch(env.to_s) else parsed_config end end private def parse_config_file(path) yaml = ERB.new(File.read(path)).result YAML.load(yaml) end end # of class methods end
Version data entries
44 entries across 44 versions & 1 rubygems