require 'yaml' module Docs class Config def initialize(config_file = 'config.yaml') @config = YAML.load(File.read(config_file)) @environment = ENV['DOCS_ENV'] || 'production' begin env = @config.delete('environment')[@environment] rescue NoMethodError env = {} end @config.merge!(env) end def method_missing(name, *args, &block) name = name.to_s if @config.has_key?(name) @config[name] else super(name, *args, &block) end end end end