Class: Butler::Plugin::ConfigProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/butler/plugin/configproxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, base = "") ⇒ ConfigProxy

Returns a new instance of ConfigProxy.



12
13
14
15
# File 'lib/butler/plugin/configproxy.rb', line 12

def initialize(config, base="")
	@config = config
	@base   = base
end

Instance Method Details

#[](key, *args) ⇒ Object



21
22
23
# File 'lib/butler/plugin/configproxy.rb', line 21

def [](key, *args)
	@config[(key.empty? ? @base : "#{@base}.#{key}"), *args]
end

#[]=(key, value) ⇒ Object



17
18
19
# File 'lib/butler/plugin/configproxy.rb', line 17

def []=(key, value)
	@config[key.empty? ? @base : "#{@base}.#{key}"] = value
end

#delete(key) ⇒ Object



30
31
32
# File 'lib/butler/plugin/configproxy.rb', line 30

def delete(key)
	@config.delete(key.empty? ? @base : "#{@base}.#{key}")
end

#exist?(key) ⇒ Boolean Also known as: has_key?

Returns:

  • (Boolean)


25
26
27
# File 'lib/butler/plugin/configproxy.rb', line 25

def exist?(key)
	@config.exist?(key.empty? ? @base : "#{@base}.#{key}")
end