Make sure bad values are filtered out.

This commit is contained in:
Glenn Y. Rolland 2015-11-29 11:35:46 +01:00
parent f07a23833f
commit 6a7ad7733d

View file

@ -38,11 +38,13 @@ class Epafh::Crawler
## Create association between extracted addreses and email part ## Create association between extracted addreses and email part
mail_struct = { mail_struct = {
from: [m.from || []].flatten, from: [m.from || []].flatten.reject{|e| e.nil?},
to: [m.to || []].flatten, to: [m.to || []].flatten.reject{|e| e.nil?},
cc: [m.cc || []].flatten, cc: [m.cc || []].flatten.reject{|e| e.nil?},
body: (body_emails.to_a || []) body: (body_emails.to_a || []).reject{|e| e.nil?}
} }
#pp m
#pp mail_struct
emails = Set.new emails = Set.new
mail_struct.each {|key, val| emails.merge val } mail_struct.each {|key, val| emails.merge val }
remaining_emails = emails.reject{|e| @contact_manager.include?(e) } remaining_emails = emails.reject{|e| @contact_manager.include?(e) }