application_lib.rb 501 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. module ApplicationLib
  3. def self.included(base)
  4. base.extend(ClassMethods)
  5. end
  6. module ClassMethods
  7. =begin
  8. load adapter based on setting option
  9. result = self.load_adapter_by_setting('some_setting_with_class_name')
  10. returns
  11. result = Some::Classname
  12. =end
  13. def load_adapter_by_setting(setting)
  14. adapter = Setting.get(setting)
  15. return if adapter.blank?
  16. adapter.constantize
  17. end
  18. end
  19. end