Class: TimetrapHarvest::Output
- Inherits:
-
Object
- Object
- TimetrapHarvest::Output
- Defined in:
- lib/timetrap_harvest/output.rb
Constant Summary collapse
- LINE_DIVIDER =
'-' * 80
- SUBMITTED_HEADER =
"Submitted entries\n#{LINE_DIVIDER}"- FAILED_HEADER =
"Failed entries\n#{LINE_DIVIDER}"
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(results = {}) ⇒ Output
constructor
A new instance of Output.
Constructor Details
#initialize(results = {}) ⇒ Output
Returns a new instance of Output.
8 9 10 |
# File 'lib/timetrap_harvest/output.rb', line 8 def initialize(results = {}) @results = results end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
6 7 8 |
# File 'lib/timetrap_harvest/output.rb', line 6 def results @results end |
Instance Method Details
#generate ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/timetrap_harvest/output.rb', line 12 def generate = [stats] unless submitted.empty? << SUBMITTED_HEADER += submitted.map { |submitted| (submitted[:notes]) } << "\n" end unless failed.empty? << FAILED_HEADER += failed.map { |failed| (failed[:note], failed[:error]) } << "\n" end .join("\n") end |