Class: Timer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTimer

Returns a new instance of Timer.



4
5
6
7
8
# File 'lib/tabata_timer/timer.rb', line 4

def initialize
  @exercise_time = 20
  @break_time = 10
  @iteration = 20
end

Instance Attribute Details

#break_timeObject

Returns the value of attribute break_time.



2
3
4
# File 'lib/tabata_timer/timer.rb', line 2

def break_time
  @break_time
end

#exercise_timeObject

Returns the value of attribute exercise_time.



2
3
4
# File 'lib/tabata_timer/timer.rb', line 2

def exercise_time
  @exercise_time
end

#iterationObject

Returns the value of attribute iteration.



2
3
4
# File 'lib/tabata_timer/timer.rb', line 2

def iteration
  @iteration
end

Instance Method Details

#startObject



10
11
12
13
14
15
16
17
18
# File 'lib/tabata_timer/timer.rb', line 10

def start
  @iteration.times do
    `say workout!`
    sleep(@exercise_time)
    `say break!`
    sleep(@break_time)
  end
  `say you very best!`
end