class Olelo::Middleware::StaticCache
Public Class Methods
new(app)
click to toggle source
# File lib/olelo/middleware/static_cache.rb, line 4 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/olelo/middleware/static_cache.rb, line 8 def call(env) # Add a cache-control header if asset is static with version string if env['PATH_INFO'].sub!(%r{^/static-\w+/}, '/static/') status, headers, body = @app.call(env) headers['Cache-Control'] = 'public, max-age=31536000' [status, headers, body] else @app.call(env) end end