Class: Lhm::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/lhm/connection.rb

Defined Under Namespace

Classes: ActiveRecordConnection, DataMapperConnection

Class Method Summary collapse

Class Method Details

.new(adapter) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/lhm/connection.rb', line 5

def self.new(adapter)
  if defined?(DataMapper) && adapter.is_a?(DataMapper::Adapters::AbstractAdapter)
    DataMapperConnection.new(adapter)
  elsif defined?(ActiveRecord)
    ActiveRecordConnection.new(adapter)
  else
    raise 'Neither DataMapper nor ActiveRecord found.'
  end
end