Class: Mayaml::MailAccount::DefaultFlagValidator
- Inherits:
-
Object
- Object
- Mayaml::MailAccount::DefaultFlagValidator
- Defined in:
- lib/mayaml/mail_account/default_flag_validator.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(flag) ⇒ DefaultFlagValidator
constructor
A new instance of DefaultFlagValidator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(flag) ⇒ DefaultFlagValidator
Returns a new instance of DefaultFlagValidator.
25 26 27 28 29 30 |
# File 'lib/mayaml/mail_account/default_flag_validator.rb', line 25 def initialize(flag) @errors = [] unless [true, false, "true", "false"].include? flag @errors << "Flag need to be 'true' or 'false'" end end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
23 24 25 |
# File 'lib/mayaml/mail_account/default_flag_validator.rb', line 23 def errors @errors end |
Instance Method Details
#valid? ⇒ Boolean
32 33 34 |
# File 'lib/mayaml/mail_account/default_flag_validator.rb', line 32 def valid? @errors.empty? end |