Sha256: a1e62fb3ef851a4d2d2a69a10a825cec7c9b49313ed9c2ebadd99889ce6458c5
Contents?: true
Size: 662 Bytes
Versions: 3
Compression:
Stored size: 662 Bytes
Contents
require 'csv' module Valigator module CSV class Validator attr_reader :filename, :errors def initialize(filename) @filename = filename @errors = [] end def validate(options = {}) ::CSV.foreach(@filename, build_options(options)) { |_row|} rescue ::CSV::MalformedCSVError, ArgumentError => error @errors << CSV::Error.new(error) end private def build_options(options = {}) { col_sep: options[:col_sep] || ',', quote_char: options[:quote_char] || '"', encoding: options[:encoding] || 'UTF-8' } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
valigator-csv-1.1.3 | lib/valigator/csv/validator.rb |
valigator-csv-1.1.2 | lib/valigator/csv/validator.rb |
valigator-csv-1.1.1 | lib/valigator/csv/validator.rb |