Lytol (owner)

Revisions

gist: 208803 Download_button fork
public
Public Clone URL: git://gist.github.com/208803.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'yaml'
 
module Rails
  module App
    extend self
        
    def [](key)
      config[key]
    end
    
    def reload!
      @config = nil
    end
    
    private
    
      def config
        @config ||= YAML::load(IO.read(File.join(Rails.root, "config/application.yml")))[Rails.env].symbolize_keys
      end
      
      def method_missing(sym, *args)
        if config.has_key?(sym) && args.empty?
          return config[sym]
        else
          super
        end
      end
    
  end
end