Method: Miscellany::LocalLruCache#fetch
- Defined in:
- lib/miscellany/local_lru_cache.rb
#fetch(key) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/miscellany/local_lru_cache.rb', line 18 def fetch(key) if @data.key?(key) self[key] else self[key] = yield end end |