Class: Soryo::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/classes/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



25
26
27
28
# File 'lib/classes/config.rb', line 25

def initialize
    super()
    merge_with(DEFAULTS)
end

Instance Method Details

#merge_with(config) ⇒ Object



30
31
32
33
34
35
# File 'lib/classes/config.rb', line 30

def merge_with(config)
    new_self = self.merge(config)
    new_self.each do |k,v|
        self[k] = v
    end
end

#read_yaml(settings) ⇒ Object

Takes in settings file path, merges yaml with settings



38
39
40
41
42
43
44
45
# File 'lib/classes/config.rb', line 38

def read_yaml(settings)
    settings_instance = Soryo::FileInstance.new(settings)
    if settings_instance.existance?
        self.merge_with(settings_instance.to_hash)
    else
        raise 'NoFileFound'
    end
end