From 6a7ad7733dc5aa9164176aab1b73e4c82468387a Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Nov 2015 11:35:46 +0100 Subject: [PATCH] Make sure bad values are filtered out. --- lib/epafh/crawler.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/epafh/crawler.rb b/lib/epafh/crawler.rb index a8c481f..d63b1c0 100644 --- a/lib/epafh/crawler.rb +++ b/lib/epafh/crawler.rb @@ -38,11 +38,13 @@ class Epafh::Crawler ## Create association between extracted addreses and email part mail_struct = { - from: [m.from || []].flatten, - to: [m.to || []].flatten, - cc: [m.cc || []].flatten, - body: (body_emails.to_a || []) + from: [m.from || []].flatten.reject{|e| e.nil?}, + to: [m.to || []].flatten.reject{|e| e.nil?}, + cc: [m.cc || []].flatten.reject{|e| e.nil?}, + body: (body_emails.to_a || []).reject{|e| e.nil?} } + #pp m + #pp mail_struct emails = Set.new mail_struct.each {|key, val| emails.merge val } remaining_emails = emails.reject{|e| @contact_manager.include?(e) }