Class: Subvalid::Validators::PresenceValidator
- Inherits:
-
Object
- Object
- Subvalid::Validators::PresenceValidator
- Defined in:
- lib/subvalid/validators/presence_validator.rb
Class Method Summary collapse
Class Method Details
.validate(object, validation_result = ValidationResult.new, *args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/subvalid/validators/presence_validator.rb', line 4 def self.validate(object, validation_result=ValidationResult.new, *args) present = if object if object.respond_to?(:present?) object.present? else object end end validation_result.add_error("is not present") unless present end |