class Mayaml::MailAccount::SmtpProtocolValidator

Constants

VALID_TYPES

Public Class Methods

new(type) click to toggle source
# File lib/mayaml/mail_account/smtp_protocol_validator.rb, line 25
def initialize(type)
  @type = convert_type(type)
  errors << "Mail account smtp_protocol is invalid. Allowed: #{types}." unless valid_type?
end

Public Instance Methods

errors() click to toggle source
# File lib/mayaml/mail_account/smtp_protocol_validator.rb, line 34
def errors
  @errors ||= []
end
valid?() click to toggle source
# File lib/mayaml/mail_account/smtp_protocol_validator.rb, line 30
def valid?
  errors.empty?
end

Private Instance Methods

convert_type(type) click to toggle source
# File lib/mayaml/mail_account/smtp_protocol_validator.rb, line 40
def convert_type(type)
  type.to_sym if type.respond_to? :to_sym
end
types() click to toggle source
# File lib/mayaml/mail_account/smtp_protocol_validator.rb, line 48
def types
  VALID_TYPES.join(", ")
end
valid_type?() click to toggle source
# File lib/mayaml/mail_account/smtp_protocol_validator.rb, line 44
def valid_type?
  VALID_TYPES.include? @type
end