Sha256: 53615fcac8f04c14cdeb6a5bd9b46466a95f39c1e801bc1f35d89a0937b99ae6

Contents?: true

Size: 662 Bytes

Versions: 3

Compression:

Stored size: 662 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.end_with?(line.chomp) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
email_assessor-0.3.3 lib/email_assessor.rb
email_assessor-0.3.2 lib/email_assessor.rb
email_assessor-0.3.1 lib/email_assessor.rb