Class: PhraseApp::InContextEditor::KeyNamesCache
- Inherits:
-
Object
- Object
- PhraseApp::InContextEditor::KeyNamesCache
- Defined in:
- lib/phraseapp-in-context-editor-ruby/key_names_cache.rb
Instance Attribute Summary collapse
-
#api_wrapper ⇒ Object
readonly
Returns the value of attribute api_wrapper.
Instance Method Summary collapse
-
#initialize(api_wrapper) ⇒ KeyNamesCache
constructor
A new instance of KeyNamesCache.
- #pre_cached(key_names) ⇒ Object
- #pre_fetched(key_names) ⇒ Object
Constructor Details
#initialize(api_wrapper) ⇒ KeyNamesCache
Returns a new instance of KeyNamesCache.
6 7 8 |
# File 'lib/phraseapp-in-context-editor-ruby/key_names_cache.rb', line 6 def initialize(api_wrapper) @api_wrapper = api_wrapper end |
Instance Attribute Details
#api_wrapper ⇒ Object (readonly)
Returns the value of attribute api_wrapper.
4 5 6 |
# File 'lib/phraseapp-in-context-editor-ruby/key_names_cache.rb', line 4 def api_wrapper @api_wrapper end |
Instance Method Details
#pre_cached(key_names) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/phraseapp-in-context-editor-ruby/key_names_cache.rb', line 10 def pre_cached(key_names) unless cache.cached?(:translation_key_names) cache.set(:translation_key_names, prefetched_key_names) end return key_names.select { |key_name| key_name_precached?(key_name) } end |
#pre_fetched(key_names) ⇒ Object
18 19 20 |
# File 'lib/phraseapp-in-context-editor-ruby/key_names_cache.rb', line 18 def pre_fetched(key_names) key_names.select { |key_name| covered_by_initial_caching?(key_name) } end |