lib/mixlib/config/configurable.rb in mixlib-config-2.0.0.rc.2 vs lib/mixlib/config/configurable.rb in mixlib-config-2.0.0.rc.3
- old
+ new
@@ -41,10 +41,15 @@
if config.has_key?(@symbol)
config[@symbol]
elsif @default
@default.call
else
- @default_value
+ begin
+ # Some things cannot be dup'd, and you won't know this till after the fact
+ config[@symbol] = @default_value.dup
+ rescue TypeError
+ @default_value
+ end
end
end
def set(config, value)
config[@symbol] = @writes_value ? @writes_value.call(value) : value