Class: SaveYourDosh::Config
- Inherits:
-
Object
- Object
- SaveYourDosh::Config
- Defined in:
- lib/save_your_dosh/config.rb
Constant Summary collapse
- DEFAULTS =
File.dirname(__FILE__) + "/../save_your_dosh.yml"
- KEYS =
%w{ new_relic heroku dynos workers notify interval }
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #read(file) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/save_your_dosh/config.rb', line 12 def initialize @new_relic = { 'acc_id' => ENV['NEW_RELIC_ID'], 'app_id' => ENV['NEW_RELIC_APP_NAME'], 'api_key' => ENV['NEW_RELIC_API_KEY'] } @heroku = { 'app_id' => ENV['APP_NAME'], 'api_key' => ENV['HEROKU_API_KEY'] } read DEFAULTS end |
Instance Method Details
#read(file) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/save_your_dosh/config.rb', line 27 def read(file) config = YAML.load_file(file) KEYS.each do |key| instance_variable_set "@#{key}", config[key] if config.has_key?(key) end end |