Module: Vedeu::Output::CompressorCache Private
- Extended by:
- CompressorCache, Repositories::Storage
- Included in:
- CompressorCache
- Defined in:
- lib/vedeu/output/compressor_cache.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Store a copy of the data last processed by Compressor. Both the original content and the compressed versions are kept (unless modified) to speed up the rendering of the display.
Class Method Summary collapse
- .in_memory ⇒ Hash<Symbol => Array<void>> private private
- .invalid_key?(key) ⇒ Boolean private private
- .invalid_value?(value) ⇒ Boolean private private
- .read(key) ⇒ Array<void> private
-
.reset! ⇒ void
(also: #reset)
extended
from Repositories::Storage
private
Remove all currently stored data for this repository.
-
.storage ⇒ void
(also: #all)
extended
from Repositories::Storage
private
Return whole repository; provides raw access to the storage for this repository.
- .write(key, value) ⇒ Hash<Symbol => Array<void>> private
Instance Method Summary collapse
- #in_memory ⇒ Hash<Symbol => Array<void>> private private
- #invalid_key?(key) ⇒ Boolean private private
- #invalid_value?(value) ⇒ Boolean private private
- #read(key) ⇒ Array<void> private
- #write(key, value) ⇒ Hash<Symbol => Array<void>> private
Class Method Details
.in_memory ⇒ Hash<Symbol => Array<void>> (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 |
# File 'lib/vedeu/output/compressor_cache.rb', line 37 def in_memory { compressed: '', original: [], } end |
.invalid_key?(key) ⇒ Boolean (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/vedeu/output/compressor_cache.rb', line 46 def invalid_key?(key) key.nil? || !in_memory.keys.include?(key) end |
.invalid_value?(value) ⇒ Boolean (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 |
# File 'lib/vedeu/output/compressor_cache.rb', line 52 def invalid_value?(value) value.nil? || value.empty? end |
.read(key) ⇒ Array<void>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/vedeu/output/compressor_cache.rb', line 21 def read(key) storage.fetch(key, []) end |
.reset! ⇒ void Also known as: reset Originally defined in module Repositories::Storage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Remove all currently stored data for this repository.
.storage ⇒ void Also known as: all Originally defined in module Repositories::Storage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Return whole repository; provides raw access to the storage for this repository.
.write(key, value) ⇒ Hash<Symbol => Array<void>>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 |
# File 'lib/vedeu/output/compressor_cache.rb', line 28 def write(key, value) return storage if invalid_key?(key) || invalid_value?(value) storage.merge!(key => value) end |
Instance Method Details
#in_memory ⇒ Hash<Symbol => Array<void>> (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 |
# File 'lib/vedeu/output/compressor_cache.rb', line 37 def in_memory { compressed: '', original: [], } end |
#invalid_key?(key) ⇒ Boolean (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/vedeu/output/compressor_cache.rb', line 46 def invalid_key?(key) key.nil? || !in_memory.keys.include?(key) end |
#invalid_value?(value) ⇒ Boolean (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 |
# File 'lib/vedeu/output/compressor_cache.rb', line 52 def invalid_value?(value) value.nil? || value.empty? end |
#read(key) ⇒ Array<void>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/vedeu/output/compressor_cache.rb', line 21 def read(key) storage.fetch(key, []) end |
#write(key, value) ⇒ Hash<Symbol => Array<void>>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 |
# File 'lib/vedeu/output/compressor_cache.rb', line 28 def write(key, value) return storage if invalid_key?(key) || invalid_value?(value) storage.merge!(key => value) end |