Class: Logbook::TaskEntry
- Inherits:
-
Struct
- Object
- Struct
- Logbook::TaskEntry
- Defined in:
- lib/logbook/task_entry.rb
Constant Summary collapse
- DATE_PROPERTY_NAME =
"Date"
Instance Attribute Summary collapse
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#note ⇒ Object
Returns the value of attribute note.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#status ⇒ Object
Returns the value of attribute status.
-
#time ⇒ Object
Returns the value of attribute time.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #belongs_to_task? ⇒ Boolean
- #merge_page_properties(properties) ⇒ Object
- #recorded_at ⇒ Object
- #starts_clock? ⇒ Boolean
- #task_id ⇒ Object
Instance Attribute Details
#line_number ⇒ Object
Returns the value of attribute line_number
4 5 6 |
# File 'lib/logbook/task_entry.rb', line 4 def line_number @line_number end |
#note ⇒ Object
Returns the value of attribute note
4 5 6 |
# File 'lib/logbook/task_entry.rb', line 4 def note @note end |
#properties ⇒ Object
Returns the value of attribute properties
4 5 6 |
# File 'lib/logbook/task_entry.rb', line 4 def properties @properties end |
#status ⇒ Object
Returns the value of attribute status
4 5 6 |
# File 'lib/logbook/task_entry.rb', line 4 def status @status end |
#time ⇒ Object
Returns the value of attribute time
4 5 6 |
# File 'lib/logbook/task_entry.rb', line 4 def time @time end |
#title ⇒ Object
Returns the value of attribute title
4 5 6 |
# File 'lib/logbook/task_entry.rb', line 4 def title @title end |
Instance Method Details
#belongs_to_task? ⇒ Boolean
7 8 9 10 |
# File 'lib/logbook/task_entry.rb', line 7 def belongs_to_task? self.properties.has_key?(Task::TASK_ID_PROPERTY) && self.properties[Task::TASK_ID_PROPERTY].has_value? end |
#merge_page_properties(properties) ⇒ Object
12 13 14 |
# File 'lib/logbook/task_entry.rb', line 12 def merge_page_properties(properties) self.properties = properties.merge(self.properties) end |
#recorded_at ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/logbook/task_entry.rb', line 16 def recorded_at date = self.properties[DATE_PROPERTY_NAME].value time = self.time DateTime.parse(date + " " + time) rescue ArgumentError end |
#starts_clock? ⇒ Boolean
24 25 26 |
# File 'lib/logbook/task_entry.rb', line 24 def starts_clock? [Task::START, Task::RESUME, Task::REOPEN].include?(self.status) end |
#task_id ⇒ Object
28 29 30 |
# File 'lib/logbook/task_entry.rb', line 28 def task_id self.properties[Task::TASK_ID_PROPERTY].value end |