lib/runby_pace/distance.rb in runby_pace-0.6.102 vs lib/runby_pace/distance.rb in runby_pace-0.6.103

- old
+ new

@@ -51,11 +51,15 @@ error_message = "#{ex.message}" end { distance: distance, error: error_message } end - def to_s - "#{format('%g', @multiplier.round(2))} #{pluralized_uom}" + def to_s(format = :long) + formatted_multiplier = format('%g', @multiplier.round(2)) + case format + when :short then "#{formatted_multiplier}#{@uom.to_s(:short)}" + when :long then "#{formatted_multiplier} #{pluralized_uom}" + end end def pluralized_uom uom_description = @uom.description.downcase if @multiplier > 1