Created
March 17, 2009 23:16
-
-
Save benalavi/80819 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
class GlobalSettings < Hash | |
# TODO: take namespace as a param and get rid of rails dependency | |
def initialize(path) | |
raise "No settings yml file found (#{path})" unless File.exists?(path) | |
settings = (YAML.load_file(path) || {})[Rails.env] || {} | |
Rails.logger.info "WARNING: No settings loaded for environment #{Rails.env}" if settings.empty? | |
update settings.symbolize_keys | |
freeze | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment