Class: Yondu::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/yondu.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Settings

Returns a new instance of Settings.



21
22
23
# File 'lib/yondu.rb', line 21

def initialize(config)
  @config = config
end

Instance Method Details

#get(*keys) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/yondu.rb', line 25

def get(*keys)
  scope = []
  value = @config

  keys.each do |key|
    raise NoHashSettingError, scope unless value.is_a?(Hash)

    scope << key
    value = value.fetch(key) { raise MissingSettingError, scope }
  end

  value
end