module ValidEmail2
Constants
- ALLOW_LIST_FILE
- DENY_LIST_FILE
- DISPOSABLE_FILE
- VERSION
Public Class Methods
Source
# File lib/valid_email2.rb, line 19 def allow_list @allow_list ||= load_if_exists(ALLOW_LIST_FILE) || Set.new end
Source
# File lib/valid_email2.rb, line 15 def deny_list @deny_list ||= load_if_exists(DENY_LIST_FILE) || Set.new end
Source
# File lib/valid_email2.rb, line 11 def disposable_emails @disposable_emails ||= load_file(DISPOSABLE_FILE) end
Private Class Methods
Source
# File lib/valid_email2.rb, line 29 def load_file(path) # This method MUST return a Set, otherwise the # performance will suffer! if path.end_with?(".yml") Set.new(YAML.load_file(path)) else File.open(path, "r").each_line.each_with_object(Set.new) do |domain, set| set << domain.tap(&:chomp!) end end end
Source
# File lib/valid_email2.rb, line 25 def load_if_exists(path) load_file(path) if File.exist?(path) end