Module: Attestor::Validations::ClassMethods
- Included in:
- Policy, Attestor::Validations
- Defined in:
- lib/attestor/validations.rb
Instance Method Summary collapse
-
#follow_policy(name, options = {}) ⇒ Attestor::Collection
Registers a followed policy.
-
#validate(name, options = {}) ⇒ Attestor::Validators
Registers a validator.
-
#validators ⇒ Attestor::Validators
private
Returns a collection of applied validators.
Instance Method Details
#follow_policy(name, options = {}) ⇒ Attestor::Collection
Registers a followed policy
Mutates the class by changing its #validators attribute!
82 83 84 |
# File 'lib/attestor/validations.rb', line 82 def follow_policy(name, = {}) @validators = validators.add(name, .merge(policy: true)) end |
#validate(name, options = {}) ⇒ Attestor::Validators
Registers a validator
Mutates the class by changing its #validators attribute!
66 67 68 |
# File 'lib/attestor/validations.rb', line 66 def validate(name, = {}) @validators = validators.add(name, ) end |
#validators ⇒ Attestor::Validators
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 collection of applied validators
50 51 52 |
# File 'lib/attestor/validations.rb', line 50 def validators @validators ||= Validators.new end |