lib/physical/cuboid.rb in physical-0.4.4 vs lib/physical/cuboid.rb in physical-0.4.5
- old
+ new
@@ -20,20 +20,21 @@
end
def density
return Measured::Density(Float::INFINITY, :g_ml) if volume.value.zero?
return Measured::Density(0.0, :g_ml) if volume.value.infinite?
+
Measured::Density(weight.convert_to(:g).value / volume.convert_to(:ml).value, :g_ml)
end
def ==(other)
other.is_a?(self.class) &&
id == other&.id
end
private
- NORMALIZED_METHOD_REGEX = /(\w+)\??$/
+ NORMALIZED_METHOD_REGEX = /(\w+)\??$/.freeze
def method_missing(method)
symbolized_properties = properties.symbolize_keys
method_name = normalize_method_name(method)
if symbolized_properties.key?(method_name)