Sha256: 488fb9c94606fd469abf382c816255ed4c5a4993ba4d7b654d48f7de4aff2b64

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

require 'yaml'

module Docs
  class Config
    def initialize(config_file)
      @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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docs-0.0.2 lib/docs/config.rb