Class: NotificationCenter::Cache
- Inherits:
-
Object
- Object
- NotificationCenter::Cache
- Defined in:
- lib/notification_center/cache.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize(app) ⇒ Cache
Returns a new instance of Cache.
23 24 25 |
# File 'lib/notification_center/cache.rb', line 23 def initialize app @app = app end |
Class Method Details
.<<(key) ⇒ Object
18 19 20 |
# File 'lib/notification_center/cache.rb', line 18 def << key open_cache << key end |
.flush_cache! ⇒ Object
6 7 8 |
# File 'lib/notification_center/cache.rb', line 6 def flush_cache! @cache = nil end |
.include?(key) ⇒ Boolean
14 15 16 |
# File 'lib/notification_center/cache.rb', line 14 def include? key open_cache.include? key end |
.open_cache ⇒ Object
10 11 12 |
# File 'lib/notification_center/cache.rb', line 10 def open_cache @cache ||= Set.new end |
Instance Method Details
#call(env) ⇒ Object
27 28 29 30 31 |
# File 'lib/notification_center/cache.rb', line 27 def call env @app.call env ensure self.class.flush_cache! end |