module LittleWeasel::Modules::DictionaryCacheKeys

This module provides methods and constants used to define, initialize and manipulate a dictionary cache Hash object.

Constants

DICTIONARIES
DICTIONARY_CACHE
DICTIONARY_ID
DICTIONARY_OBJECT
DICTIONARY_REFERENCES
SOURCE

Public Instance Methods

initialize_dictionary_cache(dictionary_cache:) click to toggle source
# File lib/LittleWeasel/modules/dictionary_cache_keys.rb, line 17
def initialize_dictionary_cache(dictionary_cache:)
  dictionary_cache.each_key { |key| dictionary_cache.delete(key) }
  dictionary_cache[DICTIONARY_CACHE] = initialized_dictionary_cache(include_root: false)
  dictionary_cache
end
initialized_dictionary_cache(include_root: true) click to toggle source
# File lib/LittleWeasel/modules/dictionary_cache_keys.rb, line 23
def initialized_dictionary_cache(include_root: true)
  dictionary_cache = {
    DICTIONARY_REFERENCES => {},
    DICTIONARIES => {}
  }
  return { DICTIONARY_CACHE => dictionary_cache } if include_root

  dictionary_cache
end