Module: Csv2hash::StructureValidator
- Included in:
- Csv2hash
- Defined in:
- lib/csv2hash/structure_validator.rb,
lib/csv2hash/structure_validator/max_columns.rb,
lib/csv2hash/structure_validator/min_columns.rb
Defined Under Namespace
Modules: Validator
Classes: MaxColumns, MinColumns, ValidationError
Instance Method Summary
collapse
Instance Method Details
#rule_instance(rule, options) ⇒ Object
15
16
17
|
# File 'lib/csv2hash/structure_validator.rb', line 15
def rule_instance rule, options
Csv2hash::StructureValidator.const_get(rule).new(options)
end
|
#validate_structure! ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/csv2hash/structure_validator.rb', line 4
def validate_structure!
definition.structure_rules.each do |rule, options|
begin
rule_instance(rule, options).validate! data_source
rescue => e
self.errors << { y: nil, x: nil, message: e.message, key: nil }
raise if exception_mode
end
end
end
|