Class: UseCase::Validator
- Includes:
- UseCaseValidations
- Defined in:
- lib/usecasing/validator.rb
Constant Summary
Constants included from UseCaseValidations
Instance Method Summary collapse
Methods included from UseCaseValidations
Methods inherited from Base
depends_all, ignored_dependencies, not_ignored, tx
Instance Method Details
#perform ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/usecasing/validator.rb', line 7 def perform targets = [*target] if target.nil? all_validations_green = false elsif targets.empty? all_validations_green = true else all_validations_green = targets.map do |object_to_validate| if Helpers._marked_for_destruction?(object_to_validate) true else valid?(object_to_validate) end end.all? end failure(self.class.to_s.downcase.to_sym, :failed) unless all_validations_green end |