Class: Rack::Date

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/rack_date.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, no_cache_control = nil, cache_control = nil) ⇒ Date

Returns a new instance of Date.



26
27
28
# File 'lib/sinatra/rack_date.rb', line 26

def initialize(app, no_cache_control = nil, cache_control = nil)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



30
31
32
33
34
# File 'lib/sinatra/rack_date.rb', line 30

def call(env)
  status, headers, body = @app.call(env)
  headers['Date'] = Time.new.httpdate if not headers['Date']
  [status, headers, body]
end