Class: Purdie::Config
- Inherits:
-
Object
- Object
- Purdie::Config
- Includes:
- Singleton
- Defined in:
- lib/purdie/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
7 8 9 |
# File 'lib/purdie/config.rb', line 7 def initialize reset! end |
Instance Method Details
#config ⇒ Object
21 22 23 |
# File 'lib/purdie/config.rb', line 21 def config @config end |
#reset! ⇒ Object
testing a singleton is hard
11 12 13 14 15 16 17 18 19 |
# File 'lib/purdie/config.rb', line 11 def reset! # testing a singleton is hard @config = OpenStruct.new fetch_yaml 'defaults' if File.exists? '_config/purdie.yaml' @local = OpenStruct.new YAML.load File.read '_config/purdie.yaml' @config = OpenStruct.new (@config.to_h.deep_merge @local) end end |