Class: ArtirixCacheService::VariablesStores::Base
- Inherits:
-
Object
- Object
- ArtirixCacheService::VariablesStores::Base
- Defined in:
- lib/artirix_cache_service/variables_stores/base.rb
Instance Method Summary collapse
Instance Method Details
#variable_get(given_key, &block) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/artirix_cache_service/variables_stores/base.rb', line 5 def variable_get(given_key, &block) key = given_key.to_sym val = retrieve(key).presence return val.to_s if val return nil unless block_given? val = block.call store key, val val.presence && val.to_s end |
#variable_set(key, value) ⇒ Object
16 17 18 19 |
# File 'lib/artirix_cache_service/variables_stores/base.rb', line 16 def variable_set(key, value) store key.to_sym, value self end |