Class: TimeTrello::ActivityRecord
- Inherits:
-
Object
- Object
- TimeTrello::ActivityRecord
- Includes:
- Comparable
- Defined in:
- lib/time_trello/activity_record.rb
Overview
Public: An activity record identifies completely an activity done in trello. Its main ideia is to be a standard record that can be compared, sorted and collected, used for reporting purposes.
Instance Attribute Summary collapse
-
#duration ⇒ Object
Public: Task duration.
-
#owner ⇒ Object
Public: Task owner.
-
#project ⇒ Object
Public: Project name (i.e., Trello board).
-
#start_date ⇒ Object
Public: Task start date.
-
#task_description ⇒ Object
Public: Task comment.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Public: Implementation of Comparable mixin.
-
#initialize(*args) ⇒ ActivityRecord
constructor
Public: Initializes this class with proper information about a given task.
Constructor Details
#initialize(*args) ⇒ ActivityRecord
Public: Initializes this class with proper information about a given task
project - Project name (i.e., the board name) owner - Name of the duration owner start_date - When the task started duration - The task duration
37 38 39 40 41 42 43 44 45 |
# File 'lib/time_trello/activity_record.rb', line 37 def initialize(*args) if args.size != 0 @duration = args[0] @owner = args[1] @project = args[2] @start_date = args[3] @task_description = args[4] end end |
Instance Attribute Details
#duration ⇒ Object
Public: Task duration
21 22 23 |
# File 'lib/time_trello/activity_record.rb', line 21 def duration @duration end |
#owner ⇒ Object
Public: Task owner
23 24 25 |
# File 'lib/time_trello/activity_record.rb', line 23 def owner @owner end |
#project ⇒ Object
Public: Project name (i.e., Trello board)
25 26 27 |
# File 'lib/time_trello/activity_record.rb', line 25 def project @project end |
#start_date ⇒ Object
Public: Task start date
27 28 29 |
# File 'lib/time_trello/activity_record.rb', line 27 def start_date @start_date end |
#task_description ⇒ Object
Public: Task comment
29 30 31 |
# File 'lib/time_trello/activity_record.rb', line 29 def task_description @task_description end |
Instance Method Details
#<=>(other) ⇒ Object
Public: Implementation of Comparable mixin. The comparison is done following this attributes hierarchy:
-
project
-
owner
-
start_date
other - The other instance of ActivityRecord to compare with.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/time_trello/activity_record.rb', line 54 def <=>(other) if other == nil return -1 end result = @project <=> other.project result = @owner <=> other.owner if result == 0 result = @start_date <=> other.start_date if result == 0 result end |