Module: Yoda::Model::Environment::WithCache
- Included in:
- InstanceAccessor, SingletonAccessor
- Defined in:
- lib/yoda/model/environment/with_cache.rb
Instance Method Summary collapse
Instance Method Details
#with_cache(cache_name) ⇒ Object
6 7 8 9 10 |
# File 'lib/yoda/model/environment/with_cache.rb', line 6 def with_cache(cache_name) cache_key = :"@#{cache_name}" return instance_variable_get(cache_key) if instance_variable_defined?(cache_key) instance_variable_set(cache_key, yield) end |