Method: XapianDb::Config#database
- Defined in:
- lib/xapian_db/config.rb
#database(path) ⇒ Object
Set the global database to use
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/xapian_db/config.rb', line 92 def database(path) # If the current database is a persistent database, we must release the # database and run the garbage collector to remove the write lock if @_database.is_a?(XapianDb::PersistentDatabase) @_database = nil GC.start end if path.to_sym == :memory @_database = XapianDb.create_db else begin @_database = XapianDb.open_db :path => path rescue IOError @_database = XapianDb.create_db :path => path end end end |