Class: Goodsheet::ValidationErrors
- Defined in:
- lib/goodsheet/validation_errors.rb
Instance Method Summary collapse
-
#add(line_number, row) ⇒ boolean
Add a potential error (will be added only if the row is not valid).
-
#initialize(limit = 0) ⇒ ValidationErrors
constructor
A new instance of ValidationErrors.
- #valid? ⇒ Boolean
Constructor Details
#initialize(limit = 0) ⇒ ValidationErrors
Returns a new instance of ValidationErrors.
5 6 7 |
# File 'lib/goodsheet/validation_errors.rb', line 5 def initialize(limit=0) @max_size = (limit==0 || limit.nil?) ? Float::INFINITY : limit end |
Instance Method Details
#add(line_number, row) ⇒ boolean
Add a potential error (will be added only if the row is not valid)
13 14 15 16 |
# File 'lib/goodsheet/validation_errors.rb', line 13 def add(line_number, row) self << ValidationError.new(line_number+1, row.errors) if row.invalid? self.size < @max_size end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/goodsheet/validation_errors.rb', line 18 def valid? empty? end |