A simple key-value store for R6::R6 generator objects. On retrieval of an object, the following applies:

  • R6 Factories (objects of class R6ClassGenerator) are initialized (with additional arguments).

  • Functions are called (with additional arguments) and must return an instance of a R6::R6 object.

  • Other objects are returned as-is.

Format

R6::R6Class object.

Construction

d = Dictionary$new()

Methods

  • get(key, ...)
    (character(1), ...) -> any
    Retrieves object with key key from the dictionary.

  • mget(keys, ...)
    (character(), ...) -> named list()
    Retrieves objects with keys keys from the dictionary, returns them in a list named with keys.

  • has(keys)
    character() -> logical()
    Returns a logical vector with TRUE at its i-th position, if the i-th key exists.

  • keys(pattern)
    character(1) -> character()
    Returns all keys which comply to the regular expression pattern.

  • add(key, value)
    (character(1), any) -> self
    Adds object value to the dictionary with key key, potentially overwriting a previously stored value.

  • remove(key)
    character() -> self
    Removes object with key key from the dictionary.

See also