Class: Purdie::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/purdie/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig



7
8
9
# File 'lib/purdie/config.rb', line 7

def initialize
  reset!
end

Instance Method Details

#configObject



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