Added doc.

This commit is contained in:
Martin Edenhofer 2013-08-15 23:15:05 +02:00
parent 6a38df013d
commit 3feab3354d

View file

@ -1,4 +1,17 @@
class ApplicationLib class ApplicationLib
=begin
load adapter based on setting option
adapter = self.load_adapter_by_setting( 'some_setting_with_class_name' )
returns
result = adapter_class
=end
def self.load_adapter_by_setting(setting) def self.load_adapter_by_setting(setting)
adapter = Setting.get( setting ) adapter = Setting.get( setting )
return if !adapter return if !adapter
@ -6,12 +19,22 @@ class ApplicationLib
# load backend # load backend
self.load_adapter(adapter) self.load_adapter(adapter)
end end
=begin
load adapter
adapter = self.load_adapter( 'some_class_name' )
returns
result = adapter_class
=end
def self.load_adapter(adapter) def self.load_adapter(adapter)
# load adapter # load adapter
backend = Object.const_get(adapter) Object.const_get(adapter)
# return backend
return backend
end end
end end