Module: Ardb::Adapter
- Defined in:
- lib/ardb.rb,
lib/ardb/adapter/base.rb,
lib/ardb/adapter/mysql.rb,
lib/ardb/adapter/sqlite.rb,
lib/ardb/adapter/postgresql.rb
Defined Under Namespace
Classes: Base, Mysql, Postgresql, Sqlite
Constant Summary
collapse
- VALID_ADAPTERS =
[
"sqlite",
"sqlite3",
"postgresql",
"postgres",
"mysql",
"mysql2",
].freeze
Class Method Summary
collapse
Class Method Details
.mysql(config) ⇒ Object
196
197
198
199
|
# File 'lib/ardb.rb', line 196
def self.mysql(config)
require "ardb/adapter/mysql"
Adapter::Mysql.new(config)
end
|
.mysql2(config) ⇒ Object
201
202
203
|
# File 'lib/ardb.rb', line 201
def self.mysql2(config)
mysql(config)
end
|
.new(config) ⇒ Object
171
172
173
174
175
176
|
# File 'lib/ardb.rb', line 171
def self.new(config)
unless VALID_ADAPTERS.include?(config.adapter)
raise InvalidAdapterError, "invalid adapter: `#{config.adapter}`"
end
send(config.adapter, config)
end
|
.postgres(config) ⇒ Object
192
193
194
|
# File 'lib/ardb.rb', line 192
def self.postgres(config)
postgresql(config)
end
|
.postgresql(config) ⇒ Object
187
188
189
190
|
# File 'lib/ardb.rb', line 187
def self.postgresql(config)
require "ardb/adapter/postgresql"
Adapter::Postgresql.new(config)
end
|
.sqlite(config) ⇒ Object
178
179
180
181
|
# File 'lib/ardb.rb', line 178
def self.sqlite(config)
require "ardb/adapter/sqlite"
Adapter::Sqlite.new(config)
end
|
.sqlite3(config) ⇒ Object
183
184
185
|
# File 'lib/ardb.rb', line 183
def self.sqlite3(config)
sqlite(config)
end
|