Sha256: 701bc39e6e8e61caf36c09df5b01be085b4b6c146b90e64dcefa65c314af9947
Contents?: true
Size: 762 Bytes
Versions: 5
Compression:
Stored size: 762 Bytes
Contents
require 'heel' require 'erb' module Heel class ErrorHandler < ::Mongrel::HttpHandler attr_reader :template def initialize(options = {}) @template = ::ERB.new File.read(File.join(APP_RESOURCE_DIR,"error.rhtml")) end def process(request,response) status = response.status if status != 200 then message = ::Mongrel::HTTP_STATUS_CODES[status] base_uri = ::Mongrel::HttpRequest.unescape(request.params[Mongrel::Const::REQUEST_URI]) response.start(status) do |head,out| head['Content-Type'] = 'text/html' out.write(template.result(binding)) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
heel-0.2.0 | lib/heel/error_handler.rb |
heel-0.3.1 | lib/heel/error_handler.rb |
heel-0.4.0 | lib/heel/error_handler.rb |
heel-0.3.0 | lib/heel/error_handler.rb |
heel-0.3.2 | lib/heel/error_handler.rb |