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



42
43
44
45
46
47
# File 'lib/utopia/extensions/rack.rb', line 42

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



49
50
51
# File 'lib/utopia/extensions/rack.rb', line 49

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

#do_not_cache!Object



37
38
39
40
# File 'lib/utopia/extensions/rack.rb', line 37

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