Module: Csvlint::ErrorCollector

Included in:
Csvw::Column, Csvw::Table, Csvw::TableGroup, Field, Schema, Validator
Defined in:
lib/csvlint/error_collector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/csvlint/error_collector.rb', line 3

def errors
  @errors
end

#info_messagesObject (readonly)

Returns the value of attribute info_messages.



3
4
5
# File 'lib/csvlint/error_collector.rb', line 3

def info_messages
  @info_messages
end

#warningsObject (readonly)

Returns the value of attribute warnings.



3
4
5
# File 'lib/csvlint/error_collector.rb', line 3

def warnings
  @warnings
end

Instance Method Details

#build_errors(type, category = nil, row = nil, column = nil, content = nil, constraints = {}) ⇒ Object

Creates a validation error



5
6
7
# File 'lib/csvlint/error_collector.rb', line 5

def build_errors(type, category = nil, row = nil, column = nil, content = nil, constraints = {})
  @errors << Csvlint::ErrorMessage.new(type, category, row, column, content, constraints)
end

#build_info_messages(type, category = nil, row = nil, column = nil, content = nil, constraints = {}) ⇒ Object

Creates a validation information message



13
14
15
# File 'lib/csvlint/error_collector.rb', line 13

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

#build_warnings(type, category = nil, row = nil, column = nil, content = nil, constraints = {}) ⇒ Object

Creates a validation warning



9
10
11
# File 'lib/csvlint/error_collector.rb', line 9

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

#resetObject



21
22
23
24
25
# File 'lib/csvlint/error_collector.rb', line 21

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

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/csvlint/error_collector.rb', line 17

def valid?
  errors.empty?
end