Class: Timmy::MasterTimer

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

Class Method Summary collapse

Class Method Details

.getObject



9
10
11
12
# File 'lib/timmy/master_timer.rb', line 9

def get
  return @duration if @duration
  Time.now.to_f - @start_time
end

.set(duration) ⇒ Object



14
15
16
# File 'lib/timmy/master_timer.rb', line 14

def set(duration)
  @duration = duration
end

.start(time = nil) ⇒ Object



4
5
6
7
# File 'lib/timmy/master_timer.rb', line 4

def start(time = nil)
  @start_time = time if time
  @start_time ||= Time.now.to_f
end