Class: ExceptionsApp::SimpleResponse
- Inherits:
-
Object
- Object
- ExceptionsApp::SimpleResponse
- Defined in:
- lib/exceptions_app/simple_response.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(headers = nil) ⇒ SimpleResponse
constructor
A new instance of SimpleResponse.
Constructor Details
#initialize(headers = nil) ⇒ SimpleResponse
Returns a new instance of SimpleResponse.
4 5 6 |
# File 'lib/exceptions_app/simple_response.rb', line 4 def initialize(headers = nil) @headers = headers end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/exceptions_app/simple_response.rb', line 8 def call(env) status = env["PATH_INFO"][1..-1] @headers ||= {} statics_path = "#{ExceptionsApp.config.statics_path}/#{status}.html" if File.exists?(statics_path) render(status, File.read(statics_path)) else [status, @headers.merge!({"X-Cascade" => "pass"}), []] end end |