Class: Timestream::EmployeeActivityReport
- Inherits:
-
Object
- Object
- Timestream::EmployeeActivityReport
show all
- Defined in:
- lib/timestream/employee_activity_report.rb
Defined Under Namespace
Classes: Cell, Timestream
Constant Summary
collapse
- DATE_CELL =
Cell.new(2, 1)
- DAY_COLUMN_SPAN =
3
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of EmployeeActivityReport.
26
27
28
|
# File 'lib/timestream/employee_activity_report.rb', line 26
def initialize(path)
@path = path
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
30
31
32
|
# File 'lib/timestream/employee_activity_report.rb', line 30
def path
@path
end
|
Instance Method Details
#cell(location) ⇒ Object
18
19
20
|
# File 'lib/timestream/employee_activity_report.rb', line 18
def cell(location)
worksheet.row(location.row)[location.column]
end
|
#row(index) ⇒ Object
32
33
34
|
# File 'lib/timestream/employee_activity_report.rb', line 32
def row(index)
worksheet.row(index)
end
|
#spreadsheet ⇒ Object
36
37
38
|
# File 'lib/timestream/employee_activity_report.rb', line 36
def spreadsheet
@spreadsheet ||= Spreadsheet.open path
end
|
#timestream_by_project_number ⇒ Object
74
75
76
77
78
79
80
|
# File 'lib/timestream/employee_activity_report.rb', line 74
def timestream_by_project_number
if @timestream_by_project_number.nil?
parse
end
@timestream_by_project_number
end
|
#to_text_table ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/timestream/employee_activity_report.rb', line 82
def to_text_table
employee_activity_report = self
table {
self.headings = ['Project Number']
self.headings.concat Timestream::SLOT_NAMES.collect { |name|
name.to_s.capitalize
}
employee_activity_report.timestream_by_project_number.each do |project_number, timestream|
row = [project_number]
timestream.each do |daily_total|
row << "%02.02f" % daily_total
end
add_row row
end
}
end
|
#worksheet ⇒ Object
101
102
103
|
# File 'lib/timestream/employee_activity_report.rb', line 101
def worksheet
@worksheet ||= spreadsheet.worksheet "EAR - Current Week"
end
|