Sha256: d46f2a69eb5181bd7a62b0bfa71b8b4587e23f54f9f41fec2de30dd5bbe25682
Contents?: true
Size: 950 Bytes
Versions: 4
Compression:
Stored size: 950 Bytes
Contents
#-- # Copyright (c) 2007, 2008 Jeremy Hinegardner # All rights reserved. Licensed under the BSD license. See LICENSE for details #++ require 'heel' require 'rack' require 'erb' module Heel class ErrorResponse < ::Rack::Response attr_reader :base_uri class << self def template_file @template_file ||= Heel::Configuration.data_path("error.rhtml") end def template @template ||= ::ERB.new(File.read(template_file)) end def homepage @homepage ||= Heel::Configuration::HOMEPAGE end end def initialize(base_uri, body, status = 404, header = {}) super(body, status, header) self['Content-type'] = 'text/html' @base_uri = base_uri end def finish message = ::Rack::Utils::HTTP_STATUS_CODES[status] homepage = ErrorResponse.homepage return [ status, header.to_hash, ErrorResponse.template.result(binding) ] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
heel-2.0.0 | lib/heel/error_response.rb |
heel-1.0.2 | lib/heel/error_response.rb |
heel-1.0.3 | lib/heel/error_response.rb |
heel-1.0.0 | lib/heel/error_response.rb |