Sha256: 837f5c4844afd4e49d09739876be8d9f9e19a1ce6da0bf31751e070a52b00971

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 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, "r:#{options[:encoding] || 'UTF-8'}") { |_row| }
      rescue ::CSV::MalformedCSVError, ArgumentError => error
        @errors << CSV::Error.new(error)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
valigator-csv-1.1.0 lib/valigator/csv/validator.rb