CsvContentValidator

Ruby gem which will allow authors to validate the content of well-formed CSV files.

Installation

Add this line to your application's Gemfile:

gem 'csv_content_validator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install csv_content_validator

Usage

require 'json'
require 'validators/recipients_validator.rb'

class RecipientsController < ApplicationController
  def create
render validator.render_errors(params[:csv_file].tempfile)
  end

  def update
render validator.render_errors(params[:csv_file].tempfile, JSON.parse(params[:corrections]))
  end

  private
  def validator
  @validator ||= RecipientsValidator.new
  end
  end

Contributing

  1. Fork it ( https://github.com/[my-github-username]/csv_content_validator/fork )
    1. Create your feature branch (git checkout -b my-new-feature)
  2. Commit your changes (git commit -am 'Add some feature')
    1. Push to the branch (git push origin my-new-feature)
  3. Create a new Pull Request