Sha256: 344bf5077fff7201393862ad65c783c2fea75a6a0a59b1503ecd46c6ed49e847
Contents?: true
Size: 605 Bytes
Versions: 3
Compression:
Stored size: 605 Bytes
Contents
require 'freemail/version' module Freemail ROOT = File.join(File.dirname(File.expand_path(__FILE__)), '../') DISPOSABLE = Hash[File.readlines("#{ROOT}/data/disposable.txt").map { |d| [d.strip.downcase] }] FREE = Hash[File.readlines("#{ROOT}/data/free.txt").map { |d| [d.strip.downcase] }] def self.free?(email) FREE.key?(get_domain(email)) end def self.disposable?(email) DISPOSABLE.key?(get_domain(email)) end def self.free_or_disposable?(email) free?(email) || disposable?(email) end def self.get_domain(email) email.split('@').last.downcase.strip end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
freemail-0.2.2 | lib/freemail.rb |
freemail-0.2.1 | lib/freemail.rb |
freemail-0.2.0 | lib/freemail.rb |