lib/squid/format.rb in squid-1.0.0.beta2 vs lib/squid/format.rb in squid-1.0.0.beta3

- old
+ new

@@ -8,15 +8,21 @@ def format_for(value, format) case format when :percentage then number_to_percentage value, precision: 1 when :currency then number_to_currency value when :seconds then number_to_minutes_and_seconds value - when :float then number_to_delimited value + when :float then number_to_float value else number_to_delimited value.to_i end.to_s end def number_to_minutes_and_seconds(value) - "#{value.round / 60}:#{(value.round % 60).to_s.rjust 2, '0'}" + signum = '-' if value < 0 + "#{signum}#{value.abs.round/60}:#{(value.abs.round%60).to_s.rjust 2, '0'}" + end + + def number_to_float(value) + float = number_to_rounded value, significant: true, precision: 2 + number_to_delimited float end end end