Module: Rack::Cache::Purge::Base
- Included in:
- Rack::Cache::Purge
- Defined in:
- lib/rack/cache/purge/base.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#purger ⇒ Object
readonly
Returns the value of attribute purger.
Instance Method Summary collapse
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
5 6 7 |
# File 'lib/rack/cache/purge/base.rb', line 5 def app @app end |
#purger ⇒ Object (readonly)
Returns the value of attribute purger.
5 6 7 |
# File 'lib/rack/cache/purge/base.rb', line 5 def purger @purger end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rack/cache/purge/base.rb', line 12 def call(env) purger = Purger.new(env) status, headers, body = app.call(env.merge(PURGER_HEADER => purger)) # TODO we probably should remove the headers here but i can't figure out # how to get the middlewares correctly pushed to the rails middleware stack # purger.purge(headers.delete(PURGE_HEADER)) if headers.key?(PURGE_HEADER) purger.purge(headers[PURGE_HEADER]) if headers.key?(PURGE_HEADER) [status, headers, body] end |
#initialize(app, options = {}) ⇒ Object
7 8 9 10 |
# File 'lib/rack/cache/purge/base.rb', line 7 def initialize(app, = {}) self.class.allow_http_purge! if [:allow_http_purge] @app = app end |