Class: ConfigFile

Inherits:
Object show all
Defined in:
lib/mobiusloop/config/config_file.rb

Class Method Summary collapse

Class Method Details

.load_template(config_file) ⇒ Object

Loads YAML file at config_path and returns Hash of key/value pairs



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mobiusloop/config/config_file.rb', line 6

def self.load_template(config_file)
  if config_file == nil || File.exists?(config_file) == false
    raise SyntaxError, "config file: #{File.expand_path(config_file)} not found"
  end

  #puts "  config: #{File.expand_path(config_file)}".colorize(:blue)
  config_yaml = YAML.load_file(config_file)
  config = Hash.new
  for item in config_yaml
    config.store(item[0], item[1])
  end
  return config
end