Class: Truemail::Validator
- Inherits:
-
Object
- Object
- Truemail::Validator
- Defined in:
- lib/truemail/validator.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- RESULT_ATTRS =
%i[success email domain mail_servers errors smtp_debug configuration].freeze
- VALIDATION_TYPES =
%i[regex mx smtp].freeze
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#validation_type ⇒ Object
readonly
Returns the value of attribute validation_type.
Instance Method Summary collapse
-
#initialize(email, with: nil, configuration:) ⇒ Validator
constructor
A new instance of Validator.
- #run ⇒ Object
Constructor Details
#initialize(email, with: nil, configuration:) ⇒ Validator
Returns a new instance of Validator.
17 18 19 20 21 22 |
# File 'lib/truemail/validator.rb', line 17 def initialize(email, with: nil, configuration:) with ||= configuration.default_validation_type raise Truemail::ArgumentError.new(with, :argument) unless Truemail::Validator::VALIDATION_TYPES.include?(with) @result = Truemail::Validator::Result.new(email: email, configuration: configuration) @validation_type = select_validation_type(email, with) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
15 16 17 |
# File 'lib/truemail/validator.rb', line 15 def result @result end |
#validation_type ⇒ Object (readonly)
Returns the value of attribute validation_type.
15 16 17 |
# File 'lib/truemail/validator.rb', line 15 def validation_type @validation_type end |