Module: LittleWeasel::Modules::DictionaryCacheKeys
- Included in:
- LittleWeasel::Metadata::DictionaryMetadata, DictionarySourceable, Services::DictionaryCacheService
- Defined in:
- lib/LittleWeasel/modules/dictionary_cache_keys.rb
Overview
This module provides methods and constants used to define, initialize and manipulate a dictionary cache Hash object.
Constant Summary collapse
- DICTIONARY_CACHE =
'dictionary_cache'
- DICTIONARY_REFERENCES =
'dictionary_references'
- DICTIONARY_ID =
'dictionary_id'
- DICTIONARIES =
'dictionaries'
- SOURCE =
'source'
- DICTIONARY_OBJECT =
'dictionary_object'
Class Method Summary collapse
- .initialize_dictionary_cache(dictionary_cache:) ⇒ Object
- .initialized_dictionary_cache(include_root: true) ⇒ Object
Instance Method Summary collapse
- #initialize_dictionary_cache(dictionary_cache:) ⇒ Object private
- #initialized_dictionary_cache(include_root: true) ⇒ Object private
Class Method Details
.initialize_dictionary_cache(dictionary_cache:) ⇒ Object
17 18 19 20 21 |
# 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) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# 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 |
Instance Method Details
#initialize_dictionary_cache(dictionary_cache:) ⇒ Object (private)
17 18 19 20 21 |
# 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) ⇒ Object (private)
23 24 25 26 27 28 29 30 31 |
# 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 |