class Goodsheet::ValidationErrors

Public Class Methods

new(limit=0) click to toggle source
# File lib/goodsheet/validation_errors.rb, line 5
def initialize(limit=0)
  @max_size = (limit==0 || limit.nil?) ? Float::INFINITY : limit
end

Public Instance Methods

add(line_number, row) click to toggle source

Add a potential error (will be added only if the row is not valid)

@param line_number [Fixnum] Line number (0-based). @return [boolean] Return false if the limit has been reached, true otherwise.

# 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?() click to toggle source
# File lib/goodsheet/validation_errors.rb, line 18
def valid?
  empty?
end