Sha256: 837e8cd80c02c91732043c1588f97cf3c2b12c9f2c1e15a1da159a296203be45

Contents?: true

Size: 854 Bytes

Versions: 6

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

require "valid_email2/email_validator"

module ValidEmail2
  BLACKLIST_FILE  = "config/blacklisted_email_domains.yml"
  WHITELIST_FILE  = "config/whitelisted_email_domains.yml"
  DISPOSABLE_FILE = File.expand_path('../config/disposable_email_domains.txt', __dir__)

  def self.disposable_emails
    @disposable_emails ||= File.open(DISPOSABLE_FILE){ |f| f.read }.split("\n")
  end

  def self.blacklist
    @blacklist ||= if File.exist?(BLACKLIST_FILE)
                     YAML.load_file(File.expand_path(BLACKLIST_FILE))
                   else
                     []
                   end
  end

  def self.whitelist
    @whitelist ||= if File.exist?(WHITELIST_FILE)
                     YAML.load_file(File.expand_path(WHITELIST_FILE))
                   else
                     []
                   end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
valid_email2-3.3.0 lib/valid_email2.rb
valid_email2-3.2.5 lib/valid_email2.rb
valid_email2-3.2.4 lib/valid_email2.rb
valid_email2-3.2.3 lib/valid_email2.rb
valid_email2-3.2.2 lib/valid_email2.rb
valid_email2-3.2.1 lib/valid_email2.rb