Module: Rhubarb::Persistence
- Defined in:
- lib/rhubarb/rhubarb.rb
Defined Under Namespace
Classes: DbCollection
Constant Summary collapse
- @@dbs =
DbCollection.new
Class Method Summary collapse
- .close(which = :default) ⇒ Object
- .db ⇒ Object
- .db=(d) ⇒ Object
- .dbs ⇒ Object
- .open(filename, which = :default) ⇒ Object
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 |
.db ⇒ Object
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 |
.dbs ⇒ Object
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 |