Added doc.
This commit is contained in:
parent
6a38df013d
commit
3feab3354d
1 changed files with 27 additions and 4 deletions
|
@ -1,4 +1,17 @@
|
|||
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)
|
||||
adapter = Setting.get( setting )
|
||||
return if !adapter
|
||||
|
@ -6,12 +19,22 @@ class ApplicationLib
|
|||
# load backend
|
||||
self.load_adapter(adapter)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
load adapter
|
||||
|
||||
adapter = self.load_adapter( 'some_class_name' )
|
||||
|
||||
returns
|
||||
|
||||
result = adapter_class
|
||||
|
||||
=end
|
||||
|
||||
def self.load_adapter(adapter)
|
||||
|
||||
# load adapter
|
||||
backend = Object.const_get(adapter)
|
||||
|
||||
# return backend
|
||||
return backend
|
||||
Object.const_get(adapter)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue