Module: Lydia::StandardPages

Included in:
Router
Defined in:
lib/lydia/standard_pages.rb

Instance Method Summary collapse

Instance Method Details

#halted(_env = nil) ⇒ Object



16
17
18
19
# File 'lib/lydia/standard_pages.rb', line 16

def halted(_env = nil)
  message = '<html><body><h1>Application halted</h1></body></html>'
  [500, { 'Content-Type' => 'text/html', 'Content-Length' => message.length.to_s }, [message]]
end

#internal_server_error(_env = nil, exception = nil) ⇒ Object



11
12
13
14
# File 'lib/lydia/standard_pages.rb', line 11

def internal_server_error(_env = nil, exception = nil)
  message = "<html><body><h1>Internal server error</h1><p>#{exception}</p></body></html>"
  [500, { 'Content-Type' => 'text/html', 'Content-Length' => message.length.to_s }, [message]]
end

#not_found(env = nil) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/lydia/standard_pages.rb', line 3

def not_found(env = nil)
  message = '<html><body>'\
            '<h1>Not Found</h1>'\
            "<p>No route matches #{env['REQUEST_METHOD']} #{env['PATH_INFO']}</p>"\
            '</body></html>'
  [404, { 'Content-Type' => 'text/html', 'Content-Length' => message.length.to_s }, [message]]
end