Class: Topographer::Importer::Helpers::WriteLogToCSV
- Inherits:
-
Object
- Object
- Topographer::Importer::Helpers::WriteLogToCSV
- Includes:
- Singleton
- Defined in:
- lib/topographer/importer/helpers/write_log_to_csv.rb
Instance Method Summary collapse
-
#initialize ⇒ WriteLogToCSV
constructor
A new instance of WriteLogToCSV.
- #write_log_to_csv(log, output_file_path, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ WriteLogToCSV
Returns a new instance of WriteLogToCSV.
6 7 8 |
# File 'lib/topographer/importer/helpers/write_log_to_csv.rb', line 6 def initialize end |
Instance Method Details
#write_log_to_csv(log, output_file_path, options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/topographer/importer/helpers/write_log_to_csv.rb', line 10 def write_log_to_csv(log, output_file_path, = {}) @log = log @write_all = .fetch(:write_all, true) CSV.open(output_file_path, 'wb') do |csv_file| csv_file << get_detail_header csv_file << get_details csv_file << get_log_header if @log.entries? @log.all_entries.each do |entry| if entry.failure? || @write_all csv_file << format_log_entry(entry) end end end end |