lib/runby_pace/distance.rb in runby_pace-0.6.103 vs lib/runby_pace/distance.rb in runby_pace-0.6.104
- old
+ new
@@ -52,22 +52,14 @@
end
{ distance: distance, error: error_message }
end
def to_s(format = :long)
- formatted_multiplier = format('%g', @multiplier.round(2))
+ 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}"
+ when :short then "#{formatted_multiplier}#{@uom.to_s(format)}"
+ when :long then "#{formatted_multiplier} #{@uom.to_s(format, plural = (@multiplier > 1))}"
end
- end
-
- def pluralized_uom
- uom_description = @uom.description.downcase
- if @multiplier > 1
- uom_description += 's'
- end
- uom_description
end
def ==(other)
raise "Cannot compare Runby::Distance to #{other.class}" unless other.is_a? Distance
@uom == other.uom && @multiplier == other.multiplier