lib/deimos/config/configurable.rb in deimos-ruby-1.4.0.pre.beta1 vs lib/deimos/config/configurable.rb in deimos-ruby-1.4.0.pre.beta2
- old
+ new
@@ -36,12 +36,10 @@
# Reset value back to default.
def reset!
if self.value.is_a?(ConfigStruct)
self.value.reset!
- elsif self.default_proc
- self.value = self.default_proc.call
else
self.value = self.default_value
end
end
@@ -204,10 +202,14 @@
if args.length.positive?
# Set the value
@settings[config_key].value = args[0]
else
# Get the value
- @settings[config_key].value
+ setting = @settings[config_key]
+ if setting.default_proc && setting.value.nil?
+ setting.value = setting.default_proc.call
+ end
+ setting.value
end
end
# Define a new setting object and use the passed block to define values.
def _new_setting_object_method(config_key, &block)