class TOTS::Printer::Dots

Your good old dots printer

Constants

CYLON_SIZE

Public Instance Methods

error(e) click to toggle source
# File lib/tots/printer/dots.rb, line 19
def error(e)
  print paint('E', RED)
end
fail(e) click to toggle source
# File lib/tots/printer/dots.rb, line 15
def fail(e)
  print paint('F', RED)
end
pass() click to toggle source
# File lib/tots/printer/dots.rb, line 7
def pass
  print paint(".", GREEN)
end
skip() click to toggle source
# File lib/tots/printer/dots.rb, line 11
def skip
  print paint('S', YELLOW)
end
summary() click to toggle source
Calls superclass method TOTS::Printer#summary
# File lib/tots/printer/dots.rb, line 23
def summary
  puts "\n\n"

  if @fails_count == 0 && @errors_count == 0
    print paint("✔ Osom! ", GREEN)
  else
    print paint("✖ Doh... ", RED)
  end

  puts paint(super, GREY)
end
waiting() click to toggle source
# File lib/tots/printer/dots.rb, line 37
def waiting
  puts "\n\n"

  i = 0

  while true
    inc =  1 if i == 0
    inc = -1 if i > (CYLON_SIZE - 3)

    dots = Array.new(CYLON_SIZE).map{ |i| ' ' }

    dots[i]           = paint("■", RED)
    dots[i - inc]     = paint("■", RED + ";2") if i > 0
    dots[i - 2 * inc] = paint("∙", RED + ";2") if i < CYLON_SIZE - 2 && i > 1

    puts "\u001b[2A\r" + paint('Watching ', GREY) + dots.join('') + "\n\n"

    sleep 0.07

    i += inc
  end
end