Class: Rack::PageCaching
- Inherits:
-
Object
- Object
- Rack::PageCaching
- Defined in:
- lib/rack/page_caching.rb,
lib/rack/page_caching/cache.rb,
lib/rack/page_caching/utils.rb,
lib/rack/page_caching/version.rb,
lib/rack/page_caching/response.rb,
lib/rack/page_caching/mime_types.rb,
lib/rack/page_caching/environment.rb,
lib/rack/page_caching/action_controller.rb
Defined Under Namespace
Modules: ActionController, Utils Classes: Cache, Environment, MimeTypes, Response
Constant Summary collapse
- VERSION =
"0.0.3"
Class Attribute Summary collapse
-
.environment ⇒ Object
Returns the value of attribute environment.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ PageCaching
constructor
A new instance of PageCaching.
Constructor Details
#initialize(app, options = {}) ⇒ PageCaching
Returns a new instance of PageCaching.
17 18 19 20 |
# File 'lib/rack/page_caching.rb', line 17 def initialize(app, = {}) @app = app self.class.environment = Rack::PageCaching::Environment.new() end |
Class Attribute Details
.environment ⇒ Object
Returns the value of attribute environment.
32 33 34 |
# File 'lib/rack/page_caching.rb', line 32 def environment @environment end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rack/page_caching.rb', line 22 def call(env) rack_response = @app.call(env) if self.class.environment.enabled? response = Rack::PageCaching::Response.new(rack_response, env) Rack::PageCaching::Cache.store(response) if response.cacheable? end rack_response end |