Sha256: f036e038bab5f48a4f01a6b7017ebec6c9677e988b919ed7b464eb99751564e9
Contents?: true
Size: 681 Bytes
Versions: 1
Compression:
Stored size: 681 Bytes
Contents
require "email_assessor/email_validator" module EmailAssessor DISPOSABLE_DOMAINS_FILE_NAME = File.expand_path("../../vendor/disposable_domains.txt", __FILE__) BLACKLISTED_DOMAINS_FILE_NAME = File.expand_path("vendor/blacklisted_domains.txt") def self.domain_is_disposable?(domain) domain_in_file?(domain, DISPOSABLE_DOMAINS_FILE_NAME) end def self.domain_is_blacklisted?(domain) domain_in_file?(domain, BLACKLISTED_DOMAINS_FILE_NAME) end protected def self.domain_in_file?(domain, file_name) file_name ||= "" domain = domain.downcase File.open(file_name).each_line.any? { |line| domain.match?(%r{\A(?:.+\.)*?#{line.chomp}\z}i) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
email_assessor-0.4.0 | lib/email_assessor.rb |