lib/mixlib/config.rb in mixlib-config-2.0.0.rc.1 vs lib/mixlib/config.rb in mixlib-config-2.0.0.rc.2
- old
+ new
@@ -29,10 +29,11 @@
class << base; attr_accessor :configurables; end
class << base; attr_accessor :config_contexts; end
base.configuration = Hash.new
base.configurables = Hash.new
base.config_contexts = Array.new
+ base.config_strict_mode false
end
# Loads a given ruby file, and runs instance_eval against it in the context of the current
# object.
#
@@ -235,11 +236,11 @@
# === Raises
# <ArgumentError>:: if value is set to something other than true, false, or :warn
#
def config_strict_mode(value = NOT_PASSED)
if value == NOT_PASSED
- @config_strict_mode || false
+ @config_strict_mode
else
self.config_strict_mode = value
end
end
@@ -305,10 +306,10 @@
if configurables.has_key?(method_symbol)
configurables[method_symbol].set(self.configuration, value)
else
if config_strict_mode == :warn
Chef::Log.warn("Setting unsupported config value #{method_name}..")
- elsif self.config_strict_mode
+ elsif config_strict_mode
raise UnknownConfigOptionError, "Cannot set unsupported config value #{method_name}."
end
configuration[method_symbol] = value
end
end