Class: Pomodoro::Formats::Today::Task
- Inherits:
-
Object
- Object
- Pomodoro::Formats::Today::Task
- Includes:
- DynamicAdditions, TaskStatuses
- Defined in:
- lib/pomodoro/formats/today/task.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#fixed_start_time ⇒ Object
readonly
Returns the value of attribute fixed_start_time.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Attributes included from DynamicAdditions
Instance Method Summary collapse
-
#initialize(status:, body:, start_time: nil, end_time: nil, fixed_start_time: nil, duration: nil, tags: [], lines: []) ⇒ Task
constructor
A new instance of Task.
- #remaining_duration(current_time_frame) ⇒ Object
- #to_s ⇒ Object
Methods included from TaskStatuses
#complete!, #completed?, #delete!, #deleted?, #ended?, #finish_for_the_day!, #in_progress?, #postpone!, #postponed?, #progress_made_but_not_finished?, #skipped?, #start!, #unstarted?
Constructor Details
#initialize(status:, body:, start_time: nil, end_time: nil, fixed_start_time: nil, duration: nil, tags: [], lines: []) ⇒ Task
Returns a new instance of Task.
22 23 24 25 26 |
# File 'lib/pomodoro/formats/today/task.rb', line 22 def initialize(status:, body:, start_time: nil, end_time: nil, fixed_start_time: nil, duration: nil, tags: [], lines: []) @status, @body, @tags, @duration = status, body, , duration @start_time, @end_time, @fixed_start_time = start_time, end_time, fixed_start_time validate_data_integrity end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def body @body end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def duration @duration end |
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def end_time @end_time end |
#fixed_start_time ⇒ Object (readonly)
Returns the value of attribute fixed_start_time.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def fixed_start_time @fixed_start_time end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def lines @lines end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def start_time @start_time end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def status @status end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
21 22 23 |
# File 'lib/pomodoro/formats/today/task.rb', line 21 def @tags end |
Instance Method Details
#remaining_duration(current_time_frame) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/pomodoro/formats/today/task.rb', line 28 def remaining_duration(current_time_frame) @start_time || raise("The task #{self.inspect} hasn't been started yet.") closing_time = @start_time + duration interval_end_time = current_time_frame.interval[1] end |