# File lib/mcollective/rpc/progress.rb, line 37 def twirl(current, total) # if the size is negative there is just not enough # space on the terminal, return a simpler version return "\r#{current} / #{total}" if @size == 0 if current == total txt = "\r %s [ " % Util.colorize(:green, "*") else txt = "\r %s [ " % Util.colorize(:red, @twirl[@twirldex]) end dashes = ((current.to_f / total) * @size).round dashes.times { txt << "=" } txt << ">" (@size - dashes).times { txt << " " } txt << " ] #{current} / #{total}" @twirldex == 7 ? @twirldex = 0 : @twirldex += 1 return txt end