Class: Mayaml::MailAccount::TypeValidator
- Inherits:
-
Object
- Object
- Mayaml::MailAccount::TypeValidator
- Defined in:
- lib/mayaml/mail_account/type_validator.rb
Constant Summary collapse
- VALID_TYPES =
%i[imap pop3 imapssl pop3ssl].freeze
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(type) ⇒ TypeValidator
constructor
A new instance of TypeValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(type) ⇒ TypeValidator
Returns a new instance of TypeValidator.
25 26 27 28 |
# File 'lib/mayaml/mail_account/type_validator.rb', line 25 def initialize(type) @type = convert_type(type) errors << "Mail account type is invalid. Allowed types: #{valid_types}." unless valid_type? end |
Instance Method Details
#errors ⇒ Object
34 35 36 |
# File 'lib/mayaml/mail_account/type_validator.rb', line 34 def errors @errors ||= [] end |
#valid? ⇒ Boolean
30 31 32 |
# File 'lib/mayaml/mail_account/type_validator.rb', line 30 def valid? errors.empty? end |