Module: Rhubarb::Persistence

Defined in:
lib/rhubarb/rhubarb.rb

Defined Under Namespace

Classes: DbCollection

Constant Summary collapse

@@dbs =
DbCollection.new

Class Method Summary collapse

Class Method Details

.close(which = :default) ⇒ Object



46
47
48
49
50
51
# File 'lib/rhubarb/rhubarb.rb', line 46

def self.close(which=:default)
  if dbs[which]
    dbs[which].close
    dbs.delete(which)
  end
end

.dbObject



53
54
55
# File 'lib/rhubarb/rhubarb.rb', line 53

def self.db
  dbs[:default]
end

.db=(d) ⇒ Object



57
58
59
# File 'lib/rhubarb/rhubarb.rb', line 57

def self.db=(d)
  dbs[:default] = d
end

.dbsObject



61
62
63
# File 'lib/rhubarb/rhubarb.rb', line 61

def self.dbs
  @@dbs
end

.open(filename, which = :default) ⇒ Object



42
43
44
# File 'lib/rhubarb/rhubarb.rb', line 42

def self.open(filename, which=:default)
  dbs[which] = SQLite3::Database.new(filename)
end