Class: Poke::Outputers::Outputer

Inherits:
Object
  • Object
show all
Defined in:
lib/poke/outputers/outputer.rb

Instance Method Summary collapse

Instance Method Details

#on_check_after(check, options = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/poke/outputers/outputer.rb', line 31

def on_check_after(check, options = {})
  if options[:returncode] == :ok
    print ".".green
    @checks_ok += 1
  else
    print ".".red
    @checks_nok += 1
  end

  puts " (" + @current_checks.to_s + "/" + @number_checks.to_s + ")" if @current_checks % 60 == 0
end

#on_check_before(check, index) ⇒ Object



27
28
29
# File 'lib/poke/outputers/outputer.rb', line 27

def on_check_before(check, index)
  @current_checks += 1
end

#on_endObject



43
44
45
46
47
48
# File 'lib/poke/outputers/outputer.rb', line 43

def on_end
  puts ""
  puts ""
  puts "Finish - Sum up".cyan
  puts "#{@number_checks} checks | " + "#{@checks_ok} ok".green + " | " + "#{@checks_nok} not ok".red
end

#on_start(checks) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/poke/outputers/outputer.rb', line 15

def on_start(checks)
  puts "POKE #{VERSION}".cyan
  puts "Automated network checks".cyan
  puts "#{checks.size} checks in the database".cyan
  puts ""

  @number_checks = checks.size
  @current_checks = 0
  @checks_ok = 0
  @checks_nok = 0
end