Class: EnumIsh::DictionaryCache
- Inherits:
-
Object
- Object
- EnumIsh::DictionaryCache
- Defined in:
- lib/enum_ish/dictionary_cache.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ DictionaryCache
constructor
A new instance of DictionaryCache.
Constructor Details
#initialize(app) ⇒ DictionaryCache
Returns a new instance of DictionaryCache.
5 6 7 |
# File 'lib/enum_ish/dictionary_cache.rb', line 5 def initialize(app) @app = app end |
Class Method Details
.cache ⇒ Object
19 20 21 |
# File 'lib/enum_ish/dictionary_cache.rb', line 19 def cache Thread.current[cache_key] end |
.enable ⇒ Object
23 24 25 26 27 28 |
# File 'lib/enum_ish/dictionary_cache.rb', line 23 def enable Thread.current[cache_key] = {} yield ensure Thread.current[cache_key] = nil end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 |
# File 'lib/enum_ish/dictionary_cache.rb', line 9 def call(env) EnumIsh::DictionaryCache.enable do @app.call(env) end end |