lib/parameters/parameters.rb in parameters-0.1.2 vs lib/parameters/parameters.rb in parameters-0.1.3
- old
+ new
@@ -146,10 +146,14 @@
def initialize_parameters
self.class.each_param do |param|
# do not override existing instance value if present
unless instance_variable_get("@#{param.name}")
begin
- value = param.value.clone
+ if param.value.kind_of?(Proc)
+ value = param.value.call()
+ else
+ value = param.value.clone
+ end
rescue TypeError
value = param.value
end
instance_variable_set("@#{param.name}",value)