Class: Vimdb::DB
- Inherits:
-
Object
- Object
- Vimdb::DB
- Defined in:
- lib/vimdb/db.rb
Instance Attribute Summary (collapse)
-
- (Object) file
Returns the value of attribute file.
Instance Method Summary (collapse)
- - (Object) get(key)
-
- (DB) initialize(file = ENV['VIMDB_DB'] || Dir.home + '/.vimdb.pstore')
constructor
A new instance of DB.
- - (Object) set(key, value)
Constructor Details
- (DB) initialize(file = ENV['VIMDB_DB'] || Dir.home + '/.vimdb.pstore')
A new instance of DB
6 7 8 9 |
# File 'lib/vimdb/db.rb', line 6 def initialize(file = ENV['VIMDB_DB'] || Dir.home + '/.vimdb.pstore') @file = file @db = PStore.new(@file) end |
Instance Attribute Details
- (Object) file
Returns the value of attribute file
5 6 7 |
# File 'lib/vimdb/db.rb', line 5 def file @file end |
Instance Method Details
- (Object) get(key)
11 12 13 |
# File 'lib/vimdb/db.rb', line 11 def get(key) @db.transaction(true) { @db[key] } end |
- (Object) set(key, value)
15 16 17 |
# File 'lib/vimdb/db.rb', line 15 def set(key, value) @db.transaction { @db[key] = value } end |