Class: AbstractValidator
- Inherits:
-
Object
- Object
- AbstractValidator
- Defined in:
- lib/abstract_validator.rb
Constant Summary collapse
- VALIDATIONS =
[]
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#is_valid ⇒ Object
(also: #valid?)
readonly
Returns the value of attribute is_valid.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model) ⇒ AbstractValidator
constructor
A new instance of AbstractValidator.
Constructor Details
#initialize(model) ⇒ AbstractValidator
Returns a new instance of AbstractValidator.
5 6 7 8 9 |
# File 'lib/abstract_validator.rb', line 5 def initialize(model) @model = model validate! @is_valid = @errors.length == 0 end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/abstract_validator.rb', line 3 def errors @errors end |
#is_valid ⇒ Object (readonly) Also known as: valid?
Returns the value of attribute is_valid.
3 4 5 |
# File 'lib/abstract_validator.rb', line 3 def is_valid @is_valid end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/abstract_validator.rb', line 3 def model @model end |