Class: Rack::PageCaching::Response
- Inherits:
-
Object
- Object
- Rack::PageCaching::Response
- Defined in:
- lib/rack/page_caching/response.rb
Instance Method Summary collapse
- #body ⇒ Object
- #cacheable? ⇒ Boolean
- #content_type ⇒ Object
- #gzip_level ⇒ Object
- #host ⇒ Object
-
#initialize(response, env) ⇒ Response
constructor
A new instance of Response.
- #path ⇒ Object
Constructor Details
#initialize(response, env) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/rack/page_caching/response.rb', line 6 def initialize(response, env) @response, @env = response, env end |
Instance Method Details
#body ⇒ Object
18 19 20 |
# File 'lib/rack/page_caching/response.rb', line 18 def body @response[2] end |
#cacheable? ⇒ Boolean
10 11 12 |
# File 'lib/rack/page_caching/response.rb', line 10 def cacheable? perform_caching? && caching_allowed? end |
#content_type ⇒ Object
22 23 24 |
# File 'lib/rack/page_caching/response.rb', line 22 def content_type @response[1]['Content-Type'].split(';').first end |
#gzip_level ⇒ Object
26 27 28 |
# File 'lib/rack/page_caching/response.rb', line 26 def gzip_level @env['rack.page_caching.compression'].to_i if @env['rack.page_caching.compression'] end |
#host ⇒ Object
30 31 32 |
# File 'lib/rack/page_caching/response.rb', line 30 def host request.host end |
#path ⇒ Object
14 15 16 |
# File 'lib/rack/page_caching/response.rb', line 14 def path @path ||= request.path end |