Class: Logbook::Task
- Inherits:
-
Object
- Object
- Logbook::Task
- Defined in:
- lib/logbook/task.rb
Constant Summary collapse
- DONE =
"Done"
- PAUSE =
"Pause"
- REOPEN =
"Reopen"
- RESUME =
"Resume"
- START =
"Start"
- TASK_ID_PROPERTY =
"ID"
Instance Attribute Summary collapse
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#id ⇒ Object
Returns the value of attribute id.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#status ⇒ Object
Returns the value of attribute status.
-
#time_logged ⇒ Object
Returns the value of attribute time_logged.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_entry(entry) ⇒ Object
-
#initialize(id) ⇒ Task
constructor
A new instance of Task.
- #log_work(entry, duration) ⇒ Object
Constructor Details
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries.
3 4 5 |
# File 'lib/logbook/task.rb', line 3 def entries @entries end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/logbook/task.rb', line 3 def id @id end |
#properties ⇒ Object
Returns the value of attribute properties.
3 4 5 |
# File 'lib/logbook/task.rb', line 3 def properties @properties end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/logbook/task.rb', line 3 def status @status end |
#time_logged ⇒ Object
Returns the value of attribute time_logged.
3 4 5 |
# File 'lib/logbook/task.rb', line 3 def time_logged @time_logged end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/logbook/task.rb', line 3 def title @title end |
Instance Method Details
#add_entry(entry) ⇒ Object
19 20 21 22 23 |
# File 'lib/logbook/task.rb', line 19 def add_entry(entry) self.properties.merge!(entry.properties) self.status = entry.status self.title = entry.title end |
#log_work(entry, duration) ⇒ Object
25 26 27 28 29 |
# File 'lib/logbook/task.rb', line 25 def log_work(entry, duration) add_entry(entry) self.time_logged += duration end |