Class: Rack::Response

Inherits:
Object show all
Defined in:
lib/utopia/extensions/rack.rb

Instance Method Summary collapse

Instance Method Details

#cache!(duration = 3600) ⇒ Object



24
25
26
27
28
29
# File 'lib/utopia/extensions/rack.rb', line 24

def cache!(duration = 3600)
	unless (self["Cache-Control"] || "").match(/no-cache/)
		self["Cache-Control"] = "public, max-age=#{duration}"
		self["Expires"] = (Time.now + duration).httpdate
	end
end

#content_type!(value) ⇒ Object



31
32
33
# File 'lib/utopia/extensions/rack.rb', line 31

def content_type!(value)
	self["Content-Type"] = value.to_s
end

#do_not_cache!Object



19
20
21
22
# File 'lib/utopia/extensions/rack.rb', line 19

def do_not_cache!
	self["Cache-Control"] = "no-cache, must-revalidate"
	self["Expires"] = Time.now.httpdate
end