Class: Closure::ShowExceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/closure/show_exceptions.rb

Overview

This is Rack middleware to show Ruby exceptions. It is automatically loaded when using Closure::Middleware. It works very much like Rack::ShowExceptions but will use the Javascript console when it can detect the request was for javascript.

If Javascript detection isn’t working because you’re not using .js.erb for the extension, add this as the first line of your script:

<% @response.headers['Content-Type'] = 'application/javascript' %>

Defined Under Namespace

Classes: Html, Javascript

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ShowExceptions

Returns a new instance of ShowExceptions.



81
82
83
# File 'lib/closure/show_exceptions.rb', line 81

def initialize(app)
  @app = Html.new(Javascript.new(app))
end

Instance Method Details

#call(env) ⇒ Object



85
86
87
# File 'lib/closure/show_exceptions.rb', line 85

def call(env)
  @app.call(env)
end