Created
June 14, 2013 16:46
-
-
Save blasterpal/5783463 to your computer and use it in GitHub Desktop.
Simple Config object for Rails or Ruby
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 SSOConfig | |
| class << self | |
| attr_accessor :config | |
| def method_missing(method_name) | |
| config[method_name.to_s] | |
| end | |
| end | |
| end | |
| SSOConfig.config = YAML.load(File.open(File.join(Rails.root,'config/signon.yml')).read)[Rails.env] | |
| # now just access via SSOConfig.<whatever> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment