From b6ede003c6b21af18e0a9417f9e7f7cd96f08279 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Fri, 20 Jul 2012 16:25:55 -0400 Subject: [PATCH] first check if we even need to run DNS before calling DNS (which is expensive) --- lib/email_veracity/domain.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/email_veracity/domain.rb b/lib/email_veracity/domain.rb index 9b23bde..5e2253f 100644 --- a/lib/email_veracity/domain.rb +++ b/lib/email_veracity/domain.rb @@ -50,13 +50,13 @@ def validate! add_error(:blacklisted) if blacklisted? && Config[:enforce_blacklist] unless Config[:skip_lookup] - add_error(:no_records) if servers.empty? && - !Config.enforced_record?(:a) && - !Config.enforced_record?(:mx) - add_error(:no_address_servers) if address_servers.empty? && - Config.enforced_record?(:a) - add_error(:no_exchange_servers) if exchange_servers.empty? && - Config.enforced_record?(:mx) + add_error(:no_records) if !Config.enforced_record?(:a) && + !Config.enforced_record?(:mx) && + servers.empty? + add_error(:no_address_servers) if Config.enforced_record?(:a) && + address_servers.empty? + add_error(:no_exchange_servers) if Config.enforced_record?(:mx) && + exchange_servers.empty? end end