lib/ardb/adapter/sqlite.rb in ardb-0.29.1 vs lib/ardb/adapter/sqlite.rb in ardb-0.29.2
- old
+ new
@@ -1,27 +1,27 @@
+# frozen_string_literal: true
+
require "fileutils"
require "ardb"
require "ardb/adapter/base"
module Ardb::Adapter
class Sqlite < Ardb::Adapter::Base
def db_file_path
- File.expand_path(self.database, self.config.root_path)
+ File.expand_path(database, config.root_path)
end
def validate!
- if File.exist?(self.db_file_path)
- raise RuntimeError, "`#{self.database}` already exists"
- end
+ raise "`#{database}` already exists" if File.exist?(db_file_path)
end
def create_db
validate!
- FileUtils.mkdir_p File.dirname(self.db_file_path)
- ActiveRecord::Base.establish_connection(self.connect_hash)
+ FileUtils.mkdir_p File.dirname(db_file_path)
+ ActiveRecord::Base.establish_connection(connect_hash)
end
def drop_db
- FileUtils.rm(self.db_file_path) if File.exist?(self.db_file_path)
+ FileUtils.rm(db_file_path) if File.exist?(db_file_path)
end
end
end