Class: Biblioteque::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/biblioteque/engine.rb

Instance Method Summary collapse

Constructor Details

#initializeEngine

Returns a new instance of Engine.



4
5
6
7
# File 'lib/biblioteque/engine.rb', line 4

def initialize
  @dbpath = nil
  @db = nil
end

Instance Method Details

#clone_current(path_destination) ⇒ Object



43
44
45
46
# File 'lib/biblioteque/engine.rb', line 43

def clone_current(path_destination)
  return false unless current_db_path
  Database.clone(current_db_path, path_destination)
end

#clone_db(path_source, path_destination) ⇒ Object



28
29
30
# File 'lib/biblioteque/engine.rb', line 28

def clone_db(path_source, path_destination)
  Database.clone(path_source, path_destination)
end

#close_dbObject



32
33
34
35
# File 'lib/biblioteque/engine.rb', line 32

def close_db
  @dbpath = nil
  @db = nil
end

#create_db(name, path) ⇒ Object



24
25
26
# File 'lib/biblioteque/engine.rb', line 24

def create_db(name, path)
  Database.create(name, path)
end

#current_dbObject



9
10
11
# File 'lib/biblioteque/engine.rb', line 9

def current_db
  @db
end

#current_db_pathObject



13
14
15
# File 'lib/biblioteque/engine.rb', line 13

def current_db_path
  @dbpath
end

#delete_dbObject



37
38
39
40
41
# File 'lib/biblioteque/engine.rb', line 37

def delete_db
  dbpath = current_db_path
  close_db
  Database.destroy(dbpath)     
end

#load_db(path) ⇒ Object



17
18
19
20
21
22
# File 'lib/biblioteque/engine.rb', line 17

def load_db(path)
  @dbpath = path
  @db = Database.new(path:path)
  @db.load
  @db
end