Class: Lotus::Validations::Validator Private
- Inherits:
-
Object
- Object
- Lotus::Validations::Validator
- Defined in:
- lib/lotus/validations/validator.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Validate given validations and return a set of errors
Instance Method Summary collapse
-
#initialize(validation_set, attributes, errors) ⇒ Validator
constructor
private
A new instance of Validator.
- #validate ⇒ Object private
Constructor Details
#initialize(validation_set, attributes, errors) ⇒ Validator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Validator.
8 9 10 11 12 |
# File 'lib/lotus/validations/validator.rb', line 8 def initialize(validation_set, attributes, errors) @validation_set = validation_set @attributes = attributes @errors = errors end |
Instance Method Details
#validate ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lotus/validations/validator.rb', line 16 def validate @errors.clear @validation_set.each do |name, validations| value = @attributes[name] value = @attributes[name.to_s] if value.nil? attribute = Attribute.new(@attributes, name, value, validations, @errors) attribute.validate end @errors end |