Class: I18nContextGenerator::Writers::CsvWriter
- Inherits:
-
Object
- Object
- I18nContextGenerator::Writers::CsvWriter
- Includes:
- ResultSerialization
- Defined in:
- lib/i18n_context_generator/writers/csv_writer.rb
Overview
Writes extraction results to a CSV file.
Constant Summary collapse
- HEADERS =
%w[ schema_version key source_file translation_key text description ui_element tone max_length confidence ambiguity_reason locations changed_locations changed_location_groups changed_translation_locations status cache_hit request_count input_tokens output_tokens retries error ].freeze
- DANGEROUS_CSV_PREFIX =
/\A[ \t\r\n]*[=+\-@]/
Constants included from ResultSerialization
ResultSerialization::OUTPUT_SCHEMA_VERSION
Instance Method Summary collapse
Instance Method Details
#write(results, path, output: $stdout, **_options) ⇒ Object
17 18 19 20 21 |
# File 'lib/i18n_context_generator/writers/csv_writer.rb', line 17 def write(results, path, output: $stdout, **) return write_rows(CSV.new(output), results) if path == '-' CSV.open(path, 'w') { |csv| write_rows(csv, results) } end |