Sinatra::Base
# File lib/vpim/agent/base.rb, line 23 def css(template) render :css, template, {} end
URL-ready form of the host and port, where the port isn’t specified if it is the default for the URL scheme.
# File lib/vpim/agent/base.rb, line 53 def host_port r = request host_port = r.host if r.scheme == "https" && r.port != 443 || r.scheme == "http" && r.port != 80 host_port << ":#{r.port}" end host_port end
Complete path, as requested by the client. Take care about CGI path rewriting.
# File lib/vpim/agent/base.rb, line 32 def request_path # Using .to_s because rack/request.rb does, though I think the Rack # spec requires these to be strings already. begin URI.parse(env["SCRIPT_URI"].to_s).path rescue env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s end end
Complete path, as requested by the client, without the env’s PATH_INFO. This is the path to whatever is “handling” the request.
Recent discussions on how PATH_INFO must be decoded leads me to think this might not work if the path had any URL encoded characters in it.
# File lib/vpim/agent/base.rb, line 47 def script_path request_path.sub(/#{env["PATH_INFO"]}$/, "") end
Generated with the Darkfish Rdoc Generator 2.