class HashComparator::Emails::Parser
Attributes
emails[RW]
options[RW]
Public Class Methods
new(emails, options)
click to toggle source
# File lib/hash_comparator/emails/parser.rb, line 8 def initialize(emails, options) @emails = emails @options = options end
parse(emails, options = {})
click to toggle source
# File lib/hash_comparator/emails/parser.rb, line 4 def self.parse(emails, options = {}) new(emails, options).parse end
Public Instance Methods
parse()
click to toggle source
# File lib/hash_comparator/emails/parser.rb, line 15 def parse remove_usernames if options[:remove_usernames] remove_generic_domains if options[:remove_generic_domains] emails end
Private Instance Methods
remove_generic_domains()
click to toggle source
# File lib/hash_comparator/emails/parser.rb, line 30 def remove_generic_domains @emails = emails.each_with_object([]) do |email, list| domain = email.split('@')[-1] list << email unless GENERIC_EMAIL_DOMAINS.include?(domain) end end
remove_usernames()
click to toggle source
# File lib/hash_comparator/emails/parser.rb, line 24 def remove_usernames @emails = emails.map do |email| email.strip.split('@')[1] end end