lib/shog/formatter.rb
# Formats a time value expressed in ms, adding color to highlight times
# outside the expected range.
#
# If `time` is more than `expected` it's highlighted yellow. If it's more
# than double it's highlighted red.
#
# @param [String] time in ms.
# @param [Float] expected maximum amount of time it should have taken.
# @return [String] the formatted time.
Formats a time value expressed in ms, adding color to highlight times
outside the expected range.

If `time` is more than `expected` it's highlighted yellow. If it's more
than double it's highlighted red.
Formats a time value expressed in ms adding color to highlight times outside the expected range . If ` time ` is more than ` expected ` it ' s highlighted yellow . If it ' s more than double it ' s highlighted red .
def format_time( time, expected = 30 )
      timef = time.uncolorize.to_f
      case
      when timef > expected * 2 then time.to_s.uncolorize.red
      when timef > expected     then time.to_s.uncolorize.yellow
      else time
      end
    end
def format_time ( time , expected = 30 ) timef = time . uncolorize . to_f case when timef > expected * 2 then time . to_s . uncolorize . red when timef > expected then time . to_s . uncolorize . yellow else time end end
Formats a time value expressed in ms, adding color to highlight times
outside the expected range.
Formats a time value expressed in ms adding color to highlight times outside the expected range .
the formatted time.
the formatted time .
String
time
<not_specific>
expected
<not_specific>
<not_specific>
expected maximum amount of time it should have taken.
expected maximum amount of time it should have taken .