Class: TimeTrello::Report
- Inherits:
-
Object
- Object
- TimeTrello::Report
- Defined in:
- lib/time_trello/report.rb
Overview
Public: This class represents a report manager on the time trello structure. It coordinates efforts with the persistence manager in order to collect data from a given trello board.
Instance Attribute Summary collapse
-
#board_id ⇒ Object
Public: board identification for reporting.
-
#end_date ⇒ Object
Public: Report end date.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#start_date ⇒ Object
Public: Report start date.
Instance Method Summary collapse
-
#find_all(&filter) ⇒ Object
Public: Generates the report based on a filter, if provided.
-
#initialize(start_date, end_date, board_id, prefix) ⇒ Report
constructor
Public: Initializes this class providing initial filter information.
Constructor Details
#initialize(start_date, end_date, board_id, prefix) ⇒ Report
Public: Initializes this class providing initial filter information
start_date - Used to limit the result set. It is the start of time records end_date - Used to limit the result set. It is the end of time records board_id - Identification of the given board. Used to grab information from an specific board.
41 42 43 44 45 46 |
# File 'lib/time_trello/report.rb', line 41 def initialize(start_date, end_date, board_id, prefix) @start_date = start_date @end_date = end_date @board_id = board_id @prefix = prefix end |
Instance Attribute Details
#board_id ⇒ Object
Public: board identification for reporting
33 34 35 |
# File 'lib/time_trello/report.rb', line 33 def board_id @board_id end |
#end_date ⇒ Object
Public: Report end date
31 32 33 |
# File 'lib/time_trello/report.rb', line 31 def end_date @end_date end |
#prefix ⇒ Object
Returns the value of attribute prefix.
27 28 29 |
# File 'lib/time_trello/report.rb', line 27 def prefix @prefix end |
#start_date ⇒ Object
Public: Report start date
29 30 31 |
# File 'lib/time_trello/report.rb', line 29 def start_date @start_date end |
Instance Method Details
#find_all(&filter) ⇒ Object
Public: Generates the report based on a filter, if provided. The filter is a block that will filter the result set accordingly. The result set is
- always an array containing instances of ActivityRecord. See
-
ActivityRecord
filter - Block used to filter the result set even further. It must follow the same format for the block passed as parameter to Array.find_all method. Each element on the array is, in fact, an instance of TimeTrello::ActivityRecord
57 58 59 60 61 62 63 64 65 |
# File 'lib/time_trello/report.rb', line 57 def find_all &filter result_set = self.driver.activities.find_all { |activity| activity.start_date >= @start_date && activity.start_date <= @end_date } if filter return result_set.find_all &filter end result_set end |