class KeyValueTree::Store

This class defines the methods expected by KeyValueTree::Hash for it's Store backend

Public Instance Methods

delete(key) click to toggle source

Delete the given key @param [String]key The key to delete @return [String] The value for key or nil

# File lib/keyvaluetree/store.rb, line 26
def delete(key)
  raise NotImplementedError
end
delete_all(key) click to toggle source

Delete all keys starting with the given prefix @param [String]key The key prefix @return nil

# File lib/keyvaluetree/store.rb, line 52
def delete_all(key)
  keys_starting_with(key.to_s).each do |each|
    self.delete(each)
  end
end
key(key) click to toggle source

Return the value for the given key @param [String]key The key to fetch @return [String] The value for key or nil

# File lib/keyvaluetree/store.rb, line 11
def key(key)
  raise NotImplementedError
end
keys() click to toggle source

Fetch all keys in store @return [Array<String>] All keys in store

# File lib/keyvaluetree/store.rb, line 36
def keys
  raise NotImplementedError
end
keys_starting_with(key) click to toggle source

Fetch all keys in store with the given key prefix @param [String]key The key prefix @return [Array<String>] All keys in store

# File lib/keyvaluetree/store.rb, line 43
def keys_starting_with(key)
  self.keys.select do |sub_key|
    sub_key.start_with?(key.to_s)
  end
end
store(key, value) click to toggle source

Store the value at the given key @param [String]key The key to store @param [String]value The value to store @return [String] The value

# File lib/keyvaluetree/store.rb, line 19
def store(key, value)
  raise NotImplementedError
end
to_hash() click to toggle source

Convert the store to a hierachical Hash return [Hash]

# File lib/keyvaluetree/store.rb, line 60
def to_hash
  raise NotImplementedError
end