Module: Oculus::Connection

Defined in:
lib/oculus/connection.rb,
lib/oculus/connection/mysql2.rb,
lib/oculus/connection/postgres.rb

Defined Under Namespace

Classes: AdapterNotFound, Error, Mysql2, Postgres

Class Method Summary collapse

Class Method Details

.connect(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/oculus/connection.rb', line 6

def self.connect(options)
  case options[:adapter]
  when 'mysql'
    require 'oculus/connection/mysql2'
    Mysql2
  when 'postgres', 'pg'
    require 'oculus/connection/postgres'
    Postgres
  else
    raise AdapterNotFound, "#{options[:adapter]} is not currently implemented. You should write it!"
  end.new(options)
end