class RIMS::Hash_KeyValueStore

Public Class Methods

new(hash) click to toggle source
# File lib/rims/hash_kvs.rb, line 4
def initialize(hash)
  @db = hash
end

Public Instance Methods

[](key) click to toggle source
# File lib/rims/hash_kvs.rb, line 8
def [](key)
  unless (key.is_a? String) then
    raise "not a string key: #{key}"
  end
  @db[key.b]
end
[]=(key, value) click to toggle source
# File lib/rims/hash_kvs.rb, line 15
def []=(key, value)
  unless (key.is_a? String) then
    raise "not a string key: #{key}"
  end
  unless (value.is_a? String) then
    raise "not a string value: #{value}"
  end
  @db[key.b] = value.b
end
close() click to toggle source
# File lib/rims/hash_kvs.rb, line 51
def close
  @db = nil
  self
end
delete(key) click to toggle source
# File lib/rims/hash_kvs.rb, line 25
def delete(key)
  unless (key.is_a? String) then
    raise "not a string key: #{key}"
  end
  @db.delete(key.b)
end
destroy() click to toggle source
# File lib/rims/hash_kvs.rb, line 56
def destroy
  self
end
each_key() { |key| ... } click to toggle source
# File lib/rims/hash_kvs.rb, line 39
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/hash_kvs.rb, line 32
def key?(key)
  unless (key.is_a? String) then
    raise "not a string key: #{key}"
  end
  @db.key? key.b
end
sync() click to toggle source
# File lib/rims/hash_kvs.rb, line 47
def sync
  self
end