Module: Pomodoro::Formats::Today::TaskStatuses
- Included in:
- Task
- Defined in:
- lib/pomodoro/formats/today/task/statuses.rb
Status checking methods collapse
- #completed? ⇒ Boolean
- #deleted? ⇒ Boolean
- #ended? ⇒ Boolean
- #in_progress? ⇒ Boolean (also: #started?)
- #postponed? ⇒ Boolean
- #progress_made_but_not_finished? ⇒ Boolean
- #skipped?(time_frame) ⇒ Boolean
- #unstarted? ⇒ Boolean
Status setters collapse
- #complete! ⇒ Object
- #delete!(reason) ⇒ Object
- #finish_for_the_day! ⇒ Object
- #postpone!(reason, next_review) ⇒ Object
- #start! ⇒ Object
Instance Method Details
#complete! ⇒ Object
48 49 50 51 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 48 def complete! @end_time = Hour.now if @start_time @status = :completed end |
#completed? ⇒ Boolean
22 23 24 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 22 def completed? @status == :done && ! self.['Reason'] end |
#delete!(reason) ⇒ Object
58 59 60 61 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 58 def delete!(reason) @end_time = Hour.now if @start_time @status = :failed end |
#deleted? ⇒ Boolean
34 35 36 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 34 def deleted? @status == :failed && self.['Deleted'] end |
#ended? ⇒ Boolean
4 5 6 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 4 def ended? [:done, :failed].include?(@status) end |
#finish_for_the_day! ⇒ Object
43 44 45 46 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 43 def finish_for_the_day! @end_time = Hour.now if @start_time @status = :progress_made end |
#in_progress? ⇒ Boolean Also known as: started?
16 17 18 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 16 def in_progress? (! @start_time.nil? && @end_time.nil?) && @status == :not_done end |
#postpone!(reason, next_review) ⇒ Object
53 54 55 56 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 53 def postpone!(reason, next_review) @end_time = Hour.now if @start_time @status = :failed end |
#postponed? ⇒ Boolean
30 31 32 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 30 def postponed? @status == :failed && self.['Postponed'] end |
#progress_made_but_not_finished? ⇒ Boolean
26 27 28 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 26 def progress_made_but_not_finished? @status == :done && self.['Reason'] end |
#skipped?(time_frame) ⇒ Boolean
12 13 14 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 12 def skipped?(time_frame) self.unstarted? && time_frame.ended? end |
#start! ⇒ Object
39 40 41 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 39 def start! @status, @start_time = :in_progress, Hour.now end |
#unstarted? ⇒ Boolean
8 9 10 |
# File 'lib/pomodoro/formats/today/task/statuses.rb', line 8 def unstarted? @start_time.nil? && @status == :not_done end |