Sha256: 5bf8fb5928a8bb41ca4182221e5b99e5c22d38ea648faa51f52490883890785e

Contents?: true

Size: 977 Bytes

Versions: 5

Compression:

Stored size: 977 Bytes

Contents

module Csvlint
  module ErrorCollector
    attr_reader :errors, :warnings, :info_messages
    # Creates a validation error
    def build_errors(type, category = nil, row = nil, column = nil, content = nil, constraints = {})
      @errors << Csvlint::ErrorMessage.new(type, category, row, column, content, constraints)
    end

    # Creates a validation warning
    def build_warnings(type, category = nil, row = nil, column = nil, content = nil, constraints = {})
      @warnings << Csvlint::ErrorMessage.new(type, category, row, column, content, constraints)
    end

    # Creates a validation information message
    def build_info_messages(type, category = nil, row = nil, column = nil, content = nil, constraints = {})
      @info_messages << Csvlint::ErrorMessage.new(type, category, row, column, content, constraints)
    end

    def valid?
      errors.empty?
    end

    def reset
      @errors = []
      @warnings = []
      @info_messages = []
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
csvlint-1.5.0 lib/csvlint/error_collector.rb
csvlint-1.4.0 lib/csvlint/error_collector.rb
csvlint-1.3.0 lib/csvlint/error_collector.rb
csvlint-1.2.0 lib/csvlint/error_collector.rb
csvlint-1.1.0 lib/csvlint/error_collector.rb