Module: Attestor::Validations::ClassMethods
- Included in:
- Policy, Attestor::Validations
- Defined in:
- lib/attestor/validations.rb
Instance Method Summary collapse
-
#follow_policy(name, except: nil, only: nil) ⇒ Attestor::Collection
Registers a followed policy.
-
#follow_validator(name, except: nil, only: nil) ⇒ Attestor::Validators
Registers a validator.
-
#validate(*args) ⇒ Attestor::Validators
Registers a validator.
-
#validators ⇒ Attestor::Validators
private
Returns a collection of applied validators.
Instance Method Details
#follow_policy(name, except: nil, only: nil) ⇒ Attestor::Collection
Registers a followed policy
Mutates the class by changing its #validators attribute!
83 84 85 |
# File 'lib/attestor/validations.rb', line 83 def follow_policy(*args) @validators = validators.add_follower(*args) end |
#follow_validator(name, except: nil, only: nil) ⇒ Attestor::Validators
Registers a validator
Mutates the class by changing its #validators attribute!
67 68 69 |
# File 'lib/attestor/validations.rb', line 67 def validate(*args) @validators = validators.add_validator(*args) end |
#validate(*args) ⇒ Attestor::Validators
Registers a validator
Mutates the class by changing its #validators attribute!
67 68 69 |
# File 'lib/attestor/validations.rb', line 67 def validate(*args) @validators = validators.add_validator(*args) 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 |