module Probe

Probe provides methods for linting a:

The linting methods:

Constants

VERSION

Public Class Methods

lint_row(csv_row, checks, opts = {}) click to toggle source
# File lib/csv/probe.rb, line 30
def self.lint_row(csv_row, checks, opts = {})
  unless csv_row.is_a? CSV::Row
    raise Error "lint_row(csv_row,...), csv_row is not of type CSV::Row, but of type '#{csv_row.class}'"
  end

  checks.each do |check|
    check.evaluate(csv_row, opts)
  rescue LintingError => e
    raise e unless opts[:exception] == false

    puts e.message # if exception oppressed, write error out on stdout
  end
end
lint_rows(csv_rows, checks, opts = {}) click to toggle source
# File lib/csv/probe.rb, line 22
def self.lint_rows(csv_rows, checks, opts = {})
  lineno_start = opts[:headers] ? 2 : 1
  csv_rows.each.with_index(lineno_start) do |row, lineno|
    opts[:lineno] = lineno
    lint_row(row, checks, opts)
  end
end