Module: CollinsShell::Console::Cache
- Included in:
- CommandHelpers
- Defined in:
- lib/collins_shell/console/cache.rb
Constant Summary collapse
- @@_cache =
{}
Instance Method Summary collapse
Instance Method Details
#cache_get_or_else(key, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/collins_shell/console/cache.rb', line 9 def cache_get_or_else key, &block if @@_cache[key].nil? then @@_cache[key] = block.call else @@_cache[key] end end |
#clear_cache ⇒ Object
5 6 7 |
# File 'lib/collins_shell/console/cache.rb', line 5 def clear_cache @@_cache = {} end |