Class: Violated::PresenceValidator
- Inherits:
-
Object
- Object
- Violated::PresenceValidator
- Defined in:
- lib/violated/validators/presence_validator.rb
Instance Method Summary collapse
-
#initialize(_) ⇒ PresenceValidator
constructor
A new instance of PresenceValidator.
- #reason ⇒ Object
- #valid?(value) ⇒ Boolean
Constructor Details
#initialize(_) ⇒ PresenceValidator
Returns a new instance of PresenceValidator.
6 7 |
# File 'lib/violated/validators/presence_validator.rb', line 6 def initialize(_) end |
Instance Method Details
#reason ⇒ Object
9 10 11 |
# File 'lib/violated/validators/presence_validator.rb', line 9 def reason :required end |
#valid?(value) ⇒ Boolean
13 14 15 |
# File 'lib/violated/validators/presence_validator.rb', line 13 def valid?(value) !value.nil? && !value.empty? end |