Class: Thoom::YamlConfig
Instance Method Summary collapse
-
#initialize(filename, env = :default) ⇒ YamlConfig
constructor
A new instance of YamlConfig.
Methods included from Config
#config_set, #env=, #get, #print, #set
Constructor Details
#initialize(filename, env = :default) ⇒ YamlConfig
Returns a new instance of YamlConfig.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/config.rb', line 64 def initialize(filename, env = :default) file = File.exist?(filename) ? filename : File.("~/#{filename}") raise ConfigFileError, "Configuration file #{filename} not found" unless File.exist? file yaml = YAML.load_file file raise ConfigFileError, "Configuration file #{file} is empty!" unless yaml @env = env config_set(yaml) end |