class EdiParser::DocumentHeader

Attributes

document_id[RW]

@return [String] the document header identifier.

Public Class Methods

new(id) click to toggle source
# File lib/edi_parser/document_header.rb, line 7
def initialize(id)
  self.document_id = id
end
parse(line) click to toggle source
# File lib/edi_parser/document_header.rb, line 11
def self.parse(line)
  raise InvalidDocumentHeaderError, "Line #{line} doesn't begin with 340 header (OCORRENCIA DA NOTA FISCAL)" unless line.start_with?("340")
  DocumentHeader.new(line[3..26].strip)
end