Measurable#convert_to! calls Measurable#convert_to to perform its operation. In-place operations are often used for performance reasons, and should not cause (unnecessary) allocations. convert_to! should do so, and convert_to should be written as self.dup.convert_to!(unit)
That being said the better option here is to just drop convert_to! in favour of immutability.
Measurable#convert_to!
callsMeasurable#convert_to
to perform its operation. In-place operations are often used for performance reasons, and should not cause (unnecessary) allocations.convert_to!
should do so, andconvert_to
should be written asself.dup.convert_to!(unit)
That being said the better option here is to just drop
convert_to!
in favour of immutability.