Class: ReplacerBot::Config
- Inherits:
-
Object
- Object
- ReplacerBot::Config
- Includes:
- Singleton
- Defined in:
- lib/replacer_bot/config.rb
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#reset! ⇒ Object
testing a singleton is hard.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 |
# File 'lib/replacer_bot/config.rb', line 5 def initialize reset! end |
Instance Method Details
#config ⇒ Object
17 18 19 |
# File 'lib/replacer_bot/config.rb', line 17 def config @config end |
#reset! ⇒ Object
testing a singleton is hard
9 10 11 12 13 14 15 |
# File 'lib/replacer_bot/config.rb', line 9 def reset! # testing a singleton is hard custom = fetch_yaml "#{ENV['HOME']}/.replacer_bot/config.yml" defaults = fetch_yaml (File.join(File.dirname(__FILE__), '..', '..', 'config/defaults.yml')) defaults.merge! custom @config = OpenStruct.new defaults end |