Class: EmailInquire::Validator::CountryCodeTld

Inherits:
Base
  • Object
show all
Defined in:
lib/email_inquire/validator/country_code_tld.rb

Constant Summary collapse

COUNTRY_CODE_TLDS =
[
  # TLD, generic com, all generic, registration with TLD only is possible
  ["jp", "co", load_data("country_code_tld/jp").freeze, true].freeze,
  ["uk", "co", load_data("country_code_tld/uk").freeze, true].freeze,
  ["br", "com", load_data("country_code_tld/br").freeze, true].freeze,
].freeze

Instance Attribute Summary

Attributes inherited from Base

#domain, #email, #name

Instance Method Summary collapse

Methods inherited from Base

validate

Constructor Details

#initialize(email) ⇒ CountryCodeTld

Returns a new instance of CountryCodeTld.



18
19
20
21
22
# File 'lib/email_inquire/validator/country_code_tld.rb', line 18

def initialize(email)
  super(email)

  *@rest, @sld, @tld = domain.split(".")
end

Instance Method Details

#validateObject



24
25
26
27
28
29
30
# File 'lib/email_inquire/validator/country_code_tld.rb', line 24

def validate
  Helper.first_value(
    COUNTRY_CODE_TLDS
  ) do |cctld, generic_com, all_generics, registration_with_cctld|
    validate_cctld(cctld, generic_com, all_generics, registration_with_cctld)
  end
end