trabajo-afectivo/lib/application_lib.rb

30 lines
501 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
module ApplicationLib
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
2013-08-15 21:15:05 +00:00
=begin
load adapter based on setting option
result = self.load_adapter_by_setting('some_setting_with_class_name')
2013-08-15 21:15:05 +00:00
returns
2013-08-17 16:09:06 +00:00
result = Some::Classname
2013-08-15 21:15:05 +00:00
=end
def load_adapter_by_setting(setting)
adapter = Setting.get(setting)
2017-11-23 08:09:44 +00:00
return if adapter.blank?
adapter.constantize
end
end
end