Class: Quiver::Validators::Presence
- Defined in:
- lib/quiver/validators/presence.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Quiver::Validators::Base
Instance Method Details
#validate ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/quiver/validators/presence.rb', line 4 def validate error_collection = Quiver::ErrorCollection.new # if options is true # then the value must be non-nil # otherwise it must be nil if if value == nil error_collection << Quiver::Model::ValidationError.new(name, failed_presence_type) end else if value != nil error_collection << Quiver::Model::ValidationError.new(name, failed_non_presence_type) end end error_collection end |