lib/email_inquire/inquirer.rb in email_inquire-0.5.0 vs lib/email_inquire/inquirer.rb in email_inquire-0.6.0
- old
+ new
@@ -27,18 +27,18 @@
parse_email
end
attr_reader :domain, :email, :name
- VALIDATORS = %i(
+ VALIDATORS = %i[
validate_common_domains
validate_one_time_providers
validate_common_domain_mistakes
validate_cc_tld
validate_common_tld_mistakes
validate_domains_with_unique_tld
- ).freeze
+ ].freeze
def validate
email_validator = EmailValidator.new(email)
unless email_validator.valid?
response.invalid!
@@ -97,10 +97,11 @@
end
end
end
COMMON_TLD_MISTAKES = {
+ ".combr" => ".com.br",
".cojp" => ".co.jp",
".couk" => ".co.uk",
".com.com" => ".com",
}.freeze
@@ -116,9 +117,10 @@
end
VALID_CC_TLDS = [
[".jp", ".co.jp", load_data("jp_tld").freeze],
[".uk", ".co.uk", load_data("uk_tld").freeze],
+ [".br", ".com.br", load_data("br_tld").freeze],
].freeze
def validate_cc_tld
VALID_CC_TLDS.each do |tld, sld, valid_tlds|
next unless domain.end_with?(tld)