trabajo-afectivo/lib/application_lib.rb
2022-01-01 14:38:12 +01:00

29 lines
501 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
module ApplicationLib
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
=begin
load adapter based on setting option
result = self.load_adapter_by_setting('some_setting_with_class_name')
returns
result = Some::Classname
=end
def load_adapter_by_setting(setting)
adapter = Setting.get(setting)
return if adapter.blank?
adapter.constantize
end
end
end