Class: SchnitzelPress::App

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Rack::Utils, SchnitzelPress::Actions::Admin, SchnitzelPress::Actions::Auth, SchnitzelPress::Actions::Blog
Defined in:
lib/schnitzelpress/app.rb

Constant Summary collapse

STATIC_PATHS =
["/favicon.ico", "/img", "/js"]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.with_local_filesObject



51
52
53
54
55
56
# File 'lib/schnitzelpress/app.rb', line 51

def self.with_local_files
  Rack::Cascade.new([
    Rack::StaticCache.new(self, :urls => STATIC_PATHS, :root => './public'),
    self
  ])
end

Instance Method Details

#cache_for(time) ⇒ Object



38
39
40
# File 'lib/schnitzelpress/app.rb', line 38

def cache_for(time)
  cache_control :public, :must_revalidate, :s_maxage => 2, :max_age => time.to_i
end

#fresh_when(options) ⇒ Object



42
43
44
45
# File 'lib/schnitzelpress/app.rb', line 42

def fresh_when(options)
  last_modified options[:last_modified]
  etag options[:etag]
end