Module: Timet::TimeReportHelper

Included in:
Table, TimeReport
Defined in:
lib/timet/time_report_helper.rb

Overview

The TimeReportHelper module provides a collection of utility methods for processing and formatting time report data. It includes methods for processing time entries, handling time blocks, formatting items for CSV export, and validating date formats. This module is designed to be included in classes that require time report processing functionalities.

Instance Method Summary collapse

Instance Method Details

#export_csvvoid

Note:

The method writes the items to a CSV file and prints a confirmation message.

This method returns an undefined value.

Exports the report to a CSV file.

Examples:

Export the report to a CSV file

time_report.export_csv


17
18
19
20
21
22
# File 'lib/timet/time_report_helper.rb', line 17

def export_csv
  file_name = "#{csv_filename}.csv"
  write_csv(file_name)

  puts "The #{file_name} has been exported."
end

#export_icalendarvoid

This method returns an undefined value.

Generates an iCalendar file and writes it to disk.



27
28
29
30
31
32
33
34
# File 'lib/timet/time_report_helper.rb', line 27

def export_icalendar
  file_name = "#{ics_filename}.ics"
  cal = Timet::Utils.add_events(items)

  File.write(file_name, cal.to_ical)

  puts "The #{file_name} has been generated."
end