class Orbit::Response

Public Class Methods

new(body=[], status=200, header={}) click to toggle source
Calls superclass method
# File lib/orbit/response.rb, line 3
def initialize(body=[], status=200, header={})
  super
  headers['Content-Type'] ||= 'text/html'
end
not_found(verb, path) click to toggle source
# File lib/orbit/response.rb, line 8
def self.not_found(verb, path)
  body = ["Oops! No route for #{verb} #{path}"]

  [404, {}, body]
end
server_error(exception, verb, path) click to toggle source
# File lib/orbit/response.rb, line 14
def self.server_error(exception, verb, path)
  body =  "Error processing: #{verb} #{path}\n\n"
  body += "#{exception.class.name}: #{exception.to_s}\n\n"
  body += "Backtrace:\n\t#{exception.backtrace.join("\n\t")}"

  Config.logger.error body

  [500, {}, [body]]
end