module Ollama::Documents::Cache::Common
def collections(prefix)
-
(Array
- an array of matching collection names)
Parameters:
-
prefix
(String
) -- a string to search for in collection names
def collections(prefix) unique = Set.new full_each { |key, _| unique << key[/\A#{prefix}(.*)-/, 1] } unique.map(&:to_sym) end
def initialize(prefix:)
def initialize(prefix:) self.prefix = prefix end
def pre(key)
-
(String)
- the joined string of prefix and key
Parameters:
-
key
(String
) -- the key to join with the prefix
def pre(key) [ @prefix, key ].join end
def unpre(key)
-
(String)
- the input string without the prefix.
Parameters:
-
key
(String
) -- the input string containing the prefix.
def unpre(key) key.sub(/\A#@prefix/, '') end