class Ach::Parser
Public Class Methods
parse_file(observer)
click to toggle source
# File lib/ach/parser.rb, line 3 def self.parse_file(observer) raise Exception.new "No file supplied. Cannot proceed!" if observer.filename.nil? File.open(observer.filename).each do |l| case l[0].chr when "1" file_header = FileHeaderRecord.decode(l) observer.file_header(file_header) when "5" batch_header = BatchHeaderRecord.decode(l) observer.batch_header(batch_header) when "6" entry_detail = EntryDetailRecord.decode(l) observer.entry_detail(entry_detail) when "8" batch_control = BatchControlRecord.decode(l) observer.batch_control(batch_control) when "9" unless (l.count "9") == 94 file_control = FileControlRecord.decode(l) observer.file_control(file_control) end else end end end