Class: PostRunner::SleepPhase
- Inherits:
-
Object
- Object
- PostRunner::SleepPhase
- Defined in:
- lib/postrunner/SleepCycle.rb
Overview
A SleepPhase is a segment of a sleep cycle. It captures the start and end time as well as the kind of phase.
Instance Attribute Summary collapse
-
#from_time ⇒ Object
readonly
Returns the value of attribute from_time.
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
-
#to_time ⇒ Object
readonly
Returns the value of attribute to_time.
Instance Method Summary collapse
-
#duration ⇒ Fixnum
Duration of the phase in seconds.
-
#initialize(from_time, to_time, phase) ⇒ SleepPhase
constructor
Create a new sleep phase.
Constructor Details
#initialize(from_time, to_time, phase) ⇒ SleepPhase
Create a new sleep phase.
25 26 27 28 29 |
# File 'lib/postrunner/SleepCycle.rb', line 25 def initialize(from_time, to_time, phase) @from_time = from_time @to_time = to_time @phase = phase end |
Instance Attribute Details
#from_time ⇒ Object (readonly)
Returns the value of attribute from_time.
19 20 21 |
# File 'lib/postrunner/SleepCycle.rb', line 19 def from_time @from_time end |
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
19 20 21 |
# File 'lib/postrunner/SleepCycle.rb', line 19 def phase @phase end |
#to_time ⇒ Object (readonly)
Returns the value of attribute to_time.
19 20 21 |
# File 'lib/postrunner/SleepCycle.rb', line 19 def to_time @to_time end |
Instance Method Details
#duration ⇒ Fixnum
Duration of the phase in seconds.
33 34 35 |
# File 'lib/postrunner/SleepCycle.rb', line 33 def duration @to_time - @from_time end |