Class: Heel::ErrorResponse
- Inherits:
-
Rack::Response
- Object
- Rack::Response
- Heel::ErrorResponse
- Defined in:
- lib/heel/error_response.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
Class Method Summary collapse
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(base_uri, body, status = 404, header = {}) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
Constructor Details
#initialize(base_uri, body, status = 404, header = {}) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
30 31 32 33 34 |
# File 'lib/heel/error_response.rb', line 30 def initialize(base_uri, body, status = 404, header = {}) super(body, status, header) self['Content-type'] = 'text/html' @base_uri = base_uri end |
Instance Attribute Details
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
14 15 16 |
# File 'lib/heel/error_response.rb', line 14 def base_uri @base_uri end |
Class Method Details
.homepage ⇒ Object
25 26 27 |
# File 'lib/heel/error_response.rb', line 25 def homepage @homepage ||= Heel::Configuration::HOMEPAGE end |
.template ⇒ Object
21 22 23 |
# File 'lib/heel/error_response.rb', line 21 def template @template ||= ::ERB.new(File.read(template_file)) end |
.template_file ⇒ Object
17 18 19 |
# File 'lib/heel/error_response.rb', line 17 def template_file @template_file ||= Heel::Configuration.data_path("error.rhtml") end |
Instance Method Details
#finish ⇒ Object
36 37 38 39 40 41 |
# File 'lib/heel/error_response.rb', line 36 def finish = ::Rack::Utils::HTTP_STATUS_CODES[status] homepage = ErrorResponse.homepage return [ status, header.to_hash, ErrorResponse.template.result(binding) ] end |