Class: Zizia::CsvFormatValidator
- Defined in:
- lib/zizia/validators/csv_format_validator.rb
Overview
A validator for correctly formatted CSV.
Instance Method Summary collapse
Methods inherited from Validator
Instance Method Details
#run_validation(parser:) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/zizia/validators/csv_format_validator.rb', line 18 def run_validation(parser:, **) return [] if CSV.parse(parser.file.read) rescue CSV::MalformedCSVError => e [Error.new(self.class, e.class, e.)] ensure parser.file.rewind end |