lib/echi-converter.rb in echi-converter-0.3.5 vs lib/echi-converter.rb in echi-converter-0.3.6
- old
+ new
@@ -219,10 +219,11 @@
begin
#Perform a transaction for each file, including the log table
#in order to commit as one atomic action upon success
EchiRecord.transaction do
bool_cnt = 0
+ bytearray = nil
@record_cnt = 0
while @binary_file.eof == FALSE do
@log.debug '<====================START RECORD ' + @record_cnt.to_s + ' ====================>'
echi_record = EchiRecord.new
@echi_schema["echi_records"].each do | field |
@@ -232,18 +233,19 @@
bytearray = dump_binary field["type"], field["length"]
end
#Ensure we parse the bytearray and set the appropriate flags
#We need to make sure the entire array is not nil, in order to do Y/N
#if Nil we then set all no
- if bytearray != nil
- if bytearray.slice(bool_cnt,1) == 1
+ if bytearray != '00000000'
+ if bytearray.slice(bool_cnt,1) == '1'
value = 'Y'
else
value = 'N'
end
else
value = 'N'
end
+ @log.debug field["name"] + " { type => #{field["type"]} & length => #{field["length"]} } value => " + value.to_s
bool_cnt += 1
if bool_cnt == 8
bool_cnt = 0
end
else
\ No newline at end of file