lib/parameters/parameters.rb in parameters-0.1.5 vs lib/parameters/parameters.rb in parameters-0.1.6
- old
+ new
@@ -22,10 +22,14 @@
# # => {:x=>5, :y=>2}
#
def params=(values)
values.each do |name,value|
if has_param?(name)
+ if (value.kind_of?(Parameters::ClassParam) || value.kind_of?(Parameters::InstanceParam))
+ value = value.value
+ end
+
get_param(name).value = value
end
end
end
@@ -236,11 +240,17 @@
# obj.params = {:x => 5, :y => 2}
# # => {:x=>5, :y=>2}
#
def params=(values)
values.each do |name,value|
+ name = name.to_sym
+
if has_param?(name)
- self.params[name.to_sym].value = value
+ if (value.kind_of?(Parameters::ClassParam) || value.kind_of?(Parameters::InstanceParam))
+ value = value.value
+ end
+
+ self.params[name].value = value
end
end
end
#