Class: RunTimer::Do_Time

Inherits:
Object
  • Object
show all
Defined in:
lib/run_timer.rb

Class Method Summary collapse

Class Method Details

.timerObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/run_timer.rb', line 8

def self.timer
  system("clear")

  $time_set = File.read("settings/ticks.txt").strip.to_i
  $wait_sec = File.read("settings/waits.txt").strip.to_i

  $hours   = 0; $minutes = 0; $seconds = 0;

  $time_set.times do
    if $hours   == 60; $hours    = 0; $hours   += 1; end
    if $minutes == 60; $minutes  = 0; $minutes += 1; end
    if $seconds == 60; $seconds  = 0; $seconds += 1; end

    $seconds += 1

    puts "Timer: #{$hours};#{$minutes};#{$seconds}"

    sleep(1)

    system("clear")
  end
end