From 46b019abd520870ab159b60c03c45675f64dd88a Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 Apr 2017 22:21:01 +0200 Subject: Rename database client classes Update our class names to reflect the new file structure introduced in b700c1bef89a67a64f1040fb6bb03c0320eefe91. Use the module DBShell module Client end end syntax intead of `DBShell::Client` so that we don't have to define the `Client` module in a separate file and require it. Otherwise we'd get an error: lib/dbshell/client/sqlite3.rb:1:in `': uninitialized constant DBShell::Client (NameError) --- lib/dbshell/client/database.rb | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'lib/dbshell/client/database.rb') diff --git a/lib/dbshell/client/database.rb b/lib/dbshell/client/database.rb index d77efce..35cb9ee 100644 --- a/lib/dbshell/client/database.rb +++ b/lib/dbshell/client/database.rb @@ -1,22 +1,26 @@ require 'dbshell/client/sqlite3' require 'dbshell/client/postgres' -class DBShell::DatabaseClient - def self.handler(connection_params) - case connection_params['adapter'] - when 'sqlite3' - DBShell::Sqlite3Client - when 'postgresql' - DBShell::PostgresClient - else - raise DBShell::InvalidDatabaseAdapter - end - end +module DBShell + module Client + class Database + def self.handler(connection_params) + case connection_params['adapter'] + when 'sqlite3' + DBShell::Client::Sqlite3 + when 'postgresql' + DBShell::Client::Postgres + else + raise DBShell::InvalidDatabaseAdapter + end + end - def self.runshell(connection_params) - self - .handler(connection_params) - .runshell(connection_params) + def self.runshell(connection_params) + self + .handler(connection_params) + .runshell(connection_params) + end + end end end -- cgit v1.2.3