Class: PuppetX::Relay::Util::OverlaySettings

Inherits:
Settings
  • Object
show all
Defined in:
lib/puppet_x/relay/util/settings.rb

Direct Known Subclasses

BackendOverlaySettings, FileSettings

Instance Method Summary collapse

Constructor Details

#initialize(parent, config) ⇒ OverlaySettings

Returns a new instance of OverlaySettings.

Parameters:

  • parent (Settings)
  • config (Hash<Symbol, Object>)


54
55
56
57
# File 'lib/puppet_x/relay/util/settings.rb', line 54

def initialize(parent, config)
  @parent = parent
  @config = config
end

Instance Method Details

#[](key) ⇒ Object



59
60
61
# File 'lib/puppet_x/relay/util/settings.rb', line 59

def [](key)
  @config.include?(key) ? @config[key] : @parent[key]
end

#each(&block) ⇒ Object



63
64
65
66
67
68
# File 'lib/puppet_x/relay/util/settings.rb', line 63

def each(&block)
  return enum_for(:each) unless block_given?

  @config.each(&block)
  @parent.each { |key, value| yield key, value unless @config.include?(key) }
end