Method: PTJ::Environment.read_config
- Defined in:
- lib/ptj/environment.rb
.read_config(file = CFGFILE) ⇒ Object
The load config method will load new configuration settings from a yaml-formatted configuration file. Note, the default configuration settings are overridden by new values specified in the configuration file.
The yaml config data is treated as a ruby hash and passed directly to load_config. See load_config for more options.
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/ptj/environment.rb', line 96 def self.read_config(file=CFGFILE) begin h = YAML.load_file(file) rescue raise(ConfigError, "Error in file: #{file} -> #{$!}") end if h.is_a?(Hash) load_config(h) else raise(ConfigError, "invalid ptj config format for file: #{file}") end end |