Class: Timetrap::Formatters::Csv
- Inherits:
-
Object
- Object
- Timetrap::Formatters::Csv
- Defined in:
- lib/timetrap/formatters/csv.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(entries) ⇒ Csv
constructor
A new instance of Csv.
Constructor Details
#initialize(entries) ⇒ Csv
Returns a new instance of Csv.
6 7 8 9 10 11 |
# File 'lib/timetrap/formatters/csv.rb', line 6 def initialize entries @output = entries.inject("start,end,note,sheet\n") do |out, e| next(out) unless e.end out << %|"#{e.start.strftime(time_format)}","#{e.end.strftime(time_format)}","#{escape(e.note)}","#{e.sheet}"\n| end end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
4 5 6 |
# File 'lib/timetrap/formatters/csv.rb', line 4 def output @output end |