Class: HashValidator::Validator::PresenceValidator
- Defined in:
- lib/hash_validator/validators/presence_validator.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ PresenceValidator
constructor
A new instance of PresenceValidator.
- #presence_error_message ⇒ Object
- #validate(key, value, _validations, errors) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ PresenceValidator
Returns a new instance of PresenceValidator.
2 3 4 |
# File 'lib/hash_validator/validators/presence_validator.rb', line 2 def initialize super('required') end |
Instance Method Details
#presence_error_message ⇒ Object
6 7 8 |
# File 'lib/hash_validator/validators/presence_validator.rb', line 6 def 'is required' end |
#validate(key, value, _validations, errors) ⇒ Object
10 11 12 13 14 |
# File 'lib/hash_validator/validators/presence_validator.rb', line 10 def validate(key, value, _validations, errors) if value.nil? errors[key] = end end |