Class: Nanoc::Github::ModifyMaxAge
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Nanoc::Github::ModifyMaxAge
- Defined in:
- lib/nanoc/github.rb
Instance Method Summary collapse
- #call(request_env) ⇒ Object
-
#initialize(app, time:) ⇒ ModifyMaxAge
constructor
A new instance of ModifyMaxAge.
Constructor Details
#initialize(app, time:) ⇒ ModifyMaxAge
Returns a new instance of ModifyMaxAge.
33 34 35 36 |
# File 'lib/nanoc/github.rb', line 33 def initialize(app, time:) @app = app @time = Integer(time) end |
Instance Method Details
#call(request_env) ⇒ Object
38 39 40 41 42 |
# File 'lib/nanoc/github.rb', line 38 def call(request_env) @app.call(request_env).on_complete do |response_env| response_env[:response_headers][:cache_control] = "public, max-age=#{@time}, s-maxage=#{@time}" end end |