Skip to content

Instantly share code, notes, and snippets.

@ryana
Created April 27, 2010 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryana/380213 to your computer and use it in GitHub Desktop.
Save ryana/380213 to your computer and use it in GitHub Desktop.
module AppConfig
def self.config
unless @config
raw_config = File.read(File.join(File.dirname(__FILE__), '..', 'config', 'harmony.yml'))
config = YAML.load(raw_config)
config = config[RAILS_ENV] if defined?(RAILS_ENV)
@config = defined?(HashWithIndifferentAccess) ? HashWithIndifferentAccess.new(config) : config
end
@config
end
def self.refresh!
@config = nil
end
def self.[](key)
config[key]
end
def self.[]=(key, value)
@config[key.to_sym] = value
end
end
@ryana
Copy link
Author

ryana commented Apr 27, 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment