Class: Norma43::LineParsers::FileFormatValidator

Inherits:
LineParser
  • Object
show all
Defined in:
lib/norma43/line_parsers/file_format_validator.rb

Instance Attribute Summary

Attributes inherited from LineParser

#line

Instance Method Summary collapse

Methods inherited from LineParser

#attributes, field, #initialize

Constructor Details

This class inherits a constructor from Norma43::LineParsers::LineParser

Instance Method Details

#errorsObject



15
16
17
18
19
# File 'lib/norma43/line_parsers/file_format_validator.rb', line 15

def errors
  errors = []
  %w(11 00).include?(record_type) || errors << ("Must start with 00 (was ”#{record_type}”)")
  errors
end

#has_document?Boolean

Returns:

  • (Boolean)


9
# File 'lib/norma43/line_parsers/file_format_validator.rb', line 9

def has_document?; file_type == "00" end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/norma43/line_parsers/file_format_validator.rb', line 11

def valid?
  errors.empty?
end