Sha256: 17cc32f0995a39ba9087e54010145d99fb8c89495c22c1bf4100b8efa8055ef4
Contents?: true
Size: 1.02 KB
Versions: 15
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module LittleWeasel module Modules # This module provides methods and constants used to define, initialize # and manipulate a dictionary cache Hash object. module DictionaryCacheKeys DICTIONARY_CACHE = 'dictionary_cache' DICTIONARY_REFERENCES = 'dictionary_references' DICTIONARY_ID = 'dictionary_id' DICTIONARIES = 'dictionaries' SOURCE = 'source' DICTIONARY_OBJECT = 'dictionary_object' module_function 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 def initialized_dictionary_cache(include_root: true) dictionary_cache = { DICTIONARY_REFERENCES => {}, DICTIONARIES => {} } return { DICTIONARY_CACHE => dictionary_cache } if include_root dictionary_cache end end end end
Version data entries
15 entries across 15 versions & 1 rubygems