2013-08-15 20:40:22 +00:00
|
|
|
class ApplicationLib
|
2013-08-15 21:15:05 +00:00
|
|
|
|
|
|
|
=begin
|
|
|
|
|
|
|
|
load adapter based on setting option
|
|
|
|
|
2013-08-15 22:11:10 +00:00
|
|
|
result = self.load_adapter_by_setting( 'some_setting_with_class_name' )
|
2013-08-15 21:15:05 +00:00
|
|
|
|
|
|
|
returns
|
|
|
|
|
|
|
|
result = adapter_class
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
2013-08-15 20:40:22 +00:00
|
|
|
def self.load_adapter_by_setting(setting)
|
|
|
|
adapter = Setting.get( setting )
|
|
|
|
return if !adapter
|
|
|
|
|
|
|
|
# load backend
|
|
|
|
self.load_adapter(adapter)
|
|
|
|
end
|
2013-08-15 21:15:05 +00:00
|
|
|
|
|
|
|
=begin
|
|
|
|
|
|
|
|
load adapter
|
|
|
|
|
2013-08-15 22:11:10 +00:00
|
|
|
result = self.load_adapter( 'some_class_name' )
|
2013-08-15 21:15:05 +00:00
|
|
|
|
|
|
|
returns
|
|
|
|
|
|
|
|
result = adapter_class
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
2013-08-15 20:40:22 +00:00
|
|
|
def self.load_adapter(adapter)
|
|
|
|
|
|
|
|
# load adapter
|
2013-08-15 21:15:05 +00:00
|
|
|
Object.const_get(adapter)
|
2013-08-15 20:40:22 +00:00
|
|
|
end
|
|
|
|
end
|