Class: DiasporaFederation::Validators::OptionalAwareValidator
- Inherits:
-
Validation::Validator
- Object
- Validation::Validator
- DiasporaFederation::Validators::OptionalAwareValidator
- Defined in:
- lib/diaspora_federation/validators/optional_aware_validator.rb
Overview
Abstract validator which only validates optional fields when they are not nil.
Direct Known Subclasses
AccountDeletionValidator, AccountMigrationValidator, CommentValidator, ContactValidator, ConversationValidator, EmbedValidator, EventParticipationValidator, EventValidator, HCardValidator, LikeValidator, LocationValidator, MessageValidator, ParticipationValidator, PersonValidator, PhotoValidator, PollAnswerValidator, PollParticipationValidator, PollValidator, ProfileValidator, ReshareValidator, RetractionValidator, StatusMessageValidator, WebFingerValidator
Instance Method Summary collapse
Instance Method Details
#rules ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/diaspora_federation/validators/optional_aware_validator.rb', line 7 def rules super.reject do |field, rules| @obj.public_send(field).nil? && !rules.map(&:class).include?(Validation::Rule::NotNil) && optional_props.include?(field) end end |