Added support for ruby 1.9.

This commit is contained in:
Martin Edenhofer 2013-08-17 18:09:06 +02:00
parent bdb581cfd8
commit f26059d0f8

View file

@ -8,7 +8,7 @@ load adapter based on setting option
returns
result = adapter_class
result = Some::Classname
=end
@ -24,17 +24,27 @@ returns
load adapter
result = self.load_adapter( 'some_class_name' )
result = self.load_adapter( 'Some::Classname' )
returns
result = adapter_class
result = Some::Classname
=end
def self.load_adapter(adapter)
# load adapter
Object.const_get(adapter)
# will only work on ruby 2.0
# Object.const_get(adapter)
# will work on ruby 1.9 and 2.0
# adapter.split('::').inject(Object) do |mod, class_name|
# mod.const_get(class_name)
# end
# will work with active_support
adapter.constantize
end
end