backend.rb 495 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Validations::TicketArticleValidator
  3. class Backend
  4. attr_reader :record
  5. def initialize(record)
  6. @record = record
  7. end
  8. def validate
  9. return if !validator_applies?
  10. validator_names.each { |elem| send(elem) }
  11. end
  12. private
  13. def validator_applies?
  14. true
  15. end
  16. def validator_names
  17. methods.select { |elem| elem.starts_with? 'validate_' }
  18. end
  19. end
  20. end