class RIMS::GDBM_KeyValueStore

Public Class Methods

exist?(path) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 12
def exist?(path)
  gdbm_path = path + '.gdbm'
  File.exist? gdbm_path
end
new(gdbm, path) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 6
def initialize(gdbm, path)
  @db = gdbm
  @path = path
end
open(path, *optional) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 17
def open(path, *optional)
  gdbm_path = path + '.gdbm'
  new(GDBM.new(gdbm_path, *optional), gdbm_path)
end
open_with_conf(name, config) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 22
def open_with_conf(name, config)
  open(name)
end

Public Instance Methods

[](key) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 27
def [](key)
  @db[key]
end
[]=(key, value) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 31
def []=(key, value)
  @db[key] = value
end
close() click to toggle source
# File lib/rims/gdbm_kvs.rb, line 56
def close
  @db.close
  self
end
delete(key) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 35
def delete(key)
  @db.delete(key)
end
destroy() click to toggle source
# File lib/rims/gdbm_kvs.rb, line 61
def destroy
  unless (@db.closed?) then
    raise "failed to destroy gdbm that isn't closed: #{@path}"
  end
  File.delete(@path)
  nil
end
each_key() { |key| ... } click to toggle source
# File lib/rims/gdbm_kvs.rb, line 43
def each_key
  return enum_for(:each_key) unless block_given?
  @db.each_key do |key|
    yield(key)
  end
  self
end
key?(key) click to toggle source
# File lib/rims/gdbm_kvs.rb, line 39
def key?(key)
  @db.key? key
end
sync() click to toggle source
# File lib/rims/gdbm_kvs.rb, line 51
def sync
  @db.sync
  self
end