class RepoMate::Database

Class for the database

Public Class Methods

new(dbfile) click to toggle source

Init

# File lib/repomate/database.rb, line 10
def initialize(dbfile)
  @db = SQLite3::Database.new(dbfile)
end

Public Instance Methods

destroy() click to toggle source

Deletes a categories directory

# File lib/repomate/database.rb, line 25
def destroy
  FileUtils.rm_r(@dbfile) if exists?
end
exists?() click to toggle source

Checks if the database file already exists

# File lib/repomate/database.rb, line 15
def exists?
  File.exists?(@dbfile)
end
query(sql) click to toggle source

Executes a query

# File lib/repomate/database.rb, line 20
def query(sql)
  @db.execute(sql)
end