class Minder::Period
Public Instance Methods
complete!()
click to toggle source
# File lib/minder/pomodoro/period.rb, line 23 def complete! Minder.play_sound('done.wav') self.ended_at = Time.now self.completed = true end
duration_in_minutes=(minutes)
click to toggle source
# File lib/minder/pomodoro/period.rb, line 14 def duration_in_minutes=(minutes) self.duration_in_seconds = minutes.to_i * 60 end
elapsed?()
click to toggle source
# File lib/minder/pomodoro/period.rb, line 29 def elapsed? elapsed_time >= duration_in_seconds end
elapsed_time()
click to toggle source
# File lib/minder/pomodoro/period.rb, line 38 def elapsed_time return 0 unless started_at return ended_at.to_i - started_at.to_i if ended_at (Time.now.to_time.to_i - started_at.to_time.to_i) end
message()
click to toggle source
# File lib/minder/pomodoro/period.rb, line 33 def message "#{Minder.formatted_time(elapsed_time)} " \ "(out of #{Minder.formatted_time(duration_in_seconds)})" end
start!()
click to toggle source
# File lib/minder/pomodoro/period.rb, line 18 def start! Minder.play_sound('start.wav') self.started_at = Time.now end