Class: Timer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(morning_range, evening_range, current_time = Time.now) ⇒ Timer

Gives back a timer object

Parameters:

  • morning_range

    Range object having from and to hours

  • evening_range

    Range object having from and to hours



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

def initialize(morning_range, evening_range, current_time= Time.now)
  @morning_range = morning_range
  @evening_range = evening_range
  @current_time = current_time
  @time_to_change = find_remaining_time
  @status = find_status
  @alt_status = alternate_status
end

Instance Attribute Details

#alt_statusObject (readonly)

Returns the value of attribute alt_status.



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

def alt_status
  @alt_status
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#time_to_changeObject (readonly)

Returns the value of attribute time_to_change.



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

def time_to_change
  @time_to_change
end