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
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#info_messages ⇒ Object
readonly
Returns the value of attribute info_messages.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#build_errors(type, category = nil, row = nil, column = nil, content = nil, constraints = {}) ⇒ Object
Creates a validation error.
-
#build_info_messages(type, category = nil, row = nil, column = nil, content = nil, constraints = {}) ⇒ Object
Creates a validation information message.
-
#build_warnings(type, category = nil, row = nil, column = nil, content = nil, constraints = {}) ⇒ Object
Creates a validation warning.
- #reset ⇒ Object
- #valid? ⇒ Boolean
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/csvlint/error_collector.rb', line 3 def errors @errors end |
#info_messages ⇒ Object (readonly)
Returns the value of attribute info_messages.
3 4 5 |
# File 'lib/csvlint/error_collector.rb', line 3 def @info_messages end |
#warnings ⇒ Object (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 (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 |
#reset ⇒ Object
21 22 23 24 25 |
# File 'lib/csvlint/error_collector.rb', line 21 def reset @errors = [] @warnings = [] @info_messages = [] end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/csvlint/error_collector.rb', line 17 def valid? errors.empty? end |