3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# 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"
= FileHeaderRecord.decode(l)
observer.()
when "5"
= BatchHeaderRecord.decode(l)
observer.()
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
|