class PostRunner::SleepPhase

A SleepPhase is a segment of a sleep cycle. It captures the start and end time as well as the kind of phase.

Attributes

from_time[R]
phase[R]
to_time[R]

Public Class Methods

new(from_time, to_time, phase) click to toggle source

Create a new sleep phase. @param from_time [Time] Start time of the phase @param to_time [Time] End time of the phase @param phase [Symbol] The kind of phase [ :rem, :nrem1, :nrem2, :nrem3 ]

# 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

Public Instance Methods

duration() click to toggle source

Duration of the phase in seconds. @return [Fixnum] duration

# File lib/postrunner/SleepCycle.rb, line 33
def duration
  @to_time - @from_time
end