trabajo-afectivo/lib/application_lib.rb

41 lines
553 B
Ruby
Raw Normal View History

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
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
def self.load_adapter(adapter)
# load adapter
2013-08-15 21:15:05 +00:00
Object.const_get(adapter)
end
end