added code to catch error in timestamp

master
Jeff Yates 2 years ago
parent f02c088201
commit 1654510a0f
  1. 9
      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

Loading…
Cancel
Save