Module: Csv2hash::Validator
Defined Under Namespace
Modules: Collection, Mapping
Instance Method Summary
collapse
Instance Method Details
#valid? ⇒ Boolean
16
|
# File 'lib/csv2hash/validator.rb', line 16
def valid?() self.errors.empty?; end
|
#validate_rules(y = nil) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/csv2hash/validator.rb', line 4
def validate_rules y=nil
definition.rules.each do |rule|
_y, x = position rule.fetch(:position)
begin
validate_cell (_y||y), x, rule
rescue => e
self.errors << { y: (_y||y), x: x, message: e.message, key: rule.fetch(:key) }
raise if exception_mode
end
end
end
|