lib/convertable_values.rb in convertable_values-0.1.1 vs lib/convertable_values.rb in convertable_values-0.1.2

- old
+ new

@@ -12,9 +12,10 @@ # pair of value/unit attributes to automatically convert the valu to/from the # given unit's base unit. def convert(value_attr, unit_attr) # Create override method for converting value to base unit when set define_method "#{value_attr}=".to_sym do |new_value| + new_value = new_value.to_f if new_value.is_a?(String) unit_str = send(unit_attr.to_sym) if new_value && unit_str # store the value converted to the base unit corresponding to the given unit if respond_to?(:write_attribute, true)