Class: Assets::Responder
- Inherits:
-
Object
- Object
- Assets::Responder
- Includes:
- AbstractType
- Defined in:
- lib/assets/responder.rb
Overview
Abstract base class for asset responders
Direct Known Subclasses
Defined Under Namespace
Classes: New, NotModified
Constant Summary collapse
- HEADERS =
IceNine.deep_freeze('Cache-Control' => 'max-age=120, must-revalidate')
- NOT_FOUND =
Response.build( Response::Status::NOT_FOUND, HEADERS.merge('Content-Type' => Assets::Mime::TXT.content_type), 'Not Found' )
Class Method Summary collapse
-
.call(asset) ⇒ Response
private
Call responder.
-
.run(request, asset) ⇒ Response
private
Run responder.
Instance Method Summary collapse
-
#response ⇒ Response
private
Return response.
Class Method Details
.call(asset) ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call responder
21 22 23 |
# File 'lib/assets/responder.rb', line 21 def self.call(asset) new(asset).response end |
.run(request, asset) ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run responder
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/assets/responder.rb', line 34 def self.run(request, asset) = request.if_modified_since responder = if && asset.fresh_at?() NotModified else New end responder.call(asset) end |
Instance Method Details
#response ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return response
53 54 55 |
# File 'lib/assets/responder.rb', line 53 def response Response.new(status, headers, body) end |