From 1654510a0fc7e3c8d5e37cb8551f6ee4b7830e89 Mon Sep 17 00:00:00 2001 From: Jeff Yates Date: Sun, 22 Nov 2020 15:58:47 -0500 Subject: [PATCH] added code to catch error in timestamp --- sorter.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sorter.rb b/sorter.rb index 0f9ee69..5984462 100755 --- a/sorter.rb +++ b/sorter.rb @@ -152,8 +152,13 @@ def process_file (file_name, binfile, type) sections = text.lines("Date and time:", chomp: true) #sections is an arrary of each date section from the text sections.delete_at(0) #we can ignore the first chunk of text sections.each do |chunk| - timestamp = chunk.lines.delete_if {|line| line == "\r\n"}[0] #pulling out the timestamp - timestamp.tr!('/','-').tr!(':','').tr!(' ','_') #remove slashes and colons from timestamp, replaces spaces with unserscores + begin + timestamp = chunk.lines.delete_if {|line| line == "\r\n"}[0] #pulling out the timestamp + timestamp.tr!('/','-').tr!(':','').tr!(' ','_') #remove slashes and colons from timestamp, replaces spaces with unserscores + rescue + pp timestamp + abort + end timestamp.strip! output = Hash.new #Creating the output storage object outfile = file_name + '_' + timestamp