lib/lanyon/application.rb in lanyon-0.4.1 vs lib/lanyon/application.rb in lanyon-0.4.2
- old
+ new
@@ -42,11 +42,11 @@
private
def response(filename) # :nodoc:
response = Rack::Response.new(File.binread(filename))
- response["Content-Type"] = media_type(filename)
+ response["Content-Type"] = media_type(filename)
response.finish
end
def html_response(body, status, headers = {}) # :nodoc:
@@ -61,21 +61,21 @@
Rack::Mime.mime_type(extension)
end
def html_wrap(title, content) # :nodoc:
- <<-document.gsub(/^ {6}/, "")
+ <<-DOCUMENT.gsub(/^ {6}/, "")
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>#{title}</title></head>
<body>
#{content}
</body>
</html>
- document
+ DOCUMENT
end
def default_404_body # :nodoc:
html_wrap("Error", "<p>404: Not Found</p>")
end
@@ -95,11 +95,11 @@
html_response(body, 405)
end
def redirect_body(to_path) # :nodoc:
- message = %Q{<p>Redirecting to <a href="#{to_path}">#{to_path}</a>.</p>}
+ message = %Q(<p>Redirecting to <a href="#{to_path}">#{to_path}</a>.</p>)
html_wrap("Redirection", message)
end
def redirect_to_dir_response(from_path) # :nodoc:
@@ -108,12 +108,12 @@
cache_time = 3600
body = redirect_body(location)
headers = {
- "Location" => location,
+ "Location" => location,
"Cache-Control" => "max-age=#{cache_time}, must-revalidate",
- "Expires" => (Time.now + cache_time).httpdate
+ "Expires" => (Time.now + cache_time).httpdate
}
html_response(body, 301, headers)
end
end