Class: Frank::Middleware::Refresh
- Inherits:
-
Object
- Object
- Frank::Middleware::Refresh
- Defined in:
- lib/frank/middleware/refresh.rb
Instance Method Summary collapse
-
#call(env) ⇒ Object
catch __refrank__ path and return the most recent timestamp.
-
#initialize(app, options = {}) ⇒ Refresh
constructor
A new instance of Refresh.
Constructor Details
#initialize(app, options = {}) ⇒ Refresh
Returns a new instance of Refresh.
5 6 7 8 |
# File 'lib/frank/middleware/refresh.rb', line 5 def initialize(app, ={}) @app = app @folders = [:watch] end |
Instance Method Details
#call(env) ⇒ Object
catch __refrank__ path and return the most recent timestamp
12 13 14 15 16 17 18 19 |
# File 'lib/frank/middleware/refresh.rb', line 12 def call(env) request = Rack::Request.new(env) if request.path_info.match /^\/__refresh__$/ [ 200, { 'Content-Type' => 'application/json', 'Connection' => 'Keep-Alive', 'Keep-Alive' => 'timeout=60', 'Cache-Control' => 'max-age=0' }, "#{get_mtime}" ] else @app.call(env) end end |