Class: EmailInquire::Inquirer
- Inherits:
-
Object
- Object
- EmailInquire::Inquirer
- Defined in:
- lib/email_inquire/inquirer.rb
Constant Summary collapse
- VALIDATORS =
[ # Format first EmailInquire::Validator::EmailFormat, # Custom overrides EmailInquire::Validator::CustomValidDomain, EmailInquire::Validator::CustomInvalidDomain, # Always valid domains EmailInquire::Validator::CommonProvider, # Invalid domains EmailInquire::Validator::KnownInvalidDomain, EmailInquire::Validator::OneTimeProvider, # Hints EmailInquire::Validator::CommonProviderMistake, EmailInquire::Validator::CommonlyMistakenDomain, EmailInquire::Validator::CommonlyMistakenTld, EmailInquire::Validator::CountryCodeTld, EmailInquire::Validator::UniqueDomainProvider, ].freeze
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Instance Method Summary collapse
-
#initialize(email) ⇒ Inquirer
constructor
A new instance of Inquirer.
- #validate ⇒ Object
Constructor Details
#initialize(email) ⇒ Inquirer
Returns a new instance of Inquirer.
43 44 45 |
# File 'lib/email_inquire/inquirer.rb', line 43 def initialize(email) @email = email&.downcase end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
47 48 49 |
# File 'lib/email_inquire/inquirer.rb', line 47 def email @email end |
Instance Method Details
#validate ⇒ Object
49 50 51 52 53 |
# File 'lib/email_inquire/inquirer.rb', line 49 def validate response = Helper.first_value(VALIDATORS) { |validator| validator.validate(email) } response || Response.new(email: email).valid! end |