Permalink
Browse files

Ensure Sinatra::ShowExceptions::TEMPLATE is used by Rack::ShowExceptions

Closes #1084

Probably, there's a better way to do this. :shrug:
  • Loading branch information...
zzak committed May 10, 2016
1 parent 4913167 commit 57c2ebb854379fd28def61340ad0b35a8edea792
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/sinatra/show_exceptions.rb
@@ -16,7 +16,6 @@ def @@eats_errors.puts(*) end
def initialize(app)
@app = app
- @template = ERB.new(TEMPLATE)
end
def call(env)
@@ -66,7 +65,7 @@ def frame_class(frame)
end
end
-TEMPLATE = <<-HTML # :nodoc:
+TEMPLATE = ERB.new <<-HTML # :nodoc:
<!DOCTYPE html>
<html>
<head>
@@ -353,3 +352,6 @@ def frame_class(frame)
HTML
end
end
+
+Rack::ShowExceptions.send :remove_const, "TEMPLATE"
+Rack::ShowExceptions.const_set "TEMPLATE", Sinatra::ShowExceptions::TEMPLATE

2 comments on commit 57c2ebb

@kgrz

This comment has been minimized.

Show comment
Hide comment
@kgrz

kgrz May 10, 2016

Member

Oh, ruby! ❤️

Member

kgrz replied May 10, 2016

Oh, ruby! ❤️

@kgrz

This comment has been minimized.

Show comment
Hide comment
@kgrz

kgrz May 10, 2016

Member

@zzak the only other way I see is to reimplement the pretty method. It looks like that's the only thing we are reusing from Rack's showexception class.

Member

kgrz replied May 10, 2016

@zzak the only other way I see is to reimplement the pretty method. It looks like that's the only thing we are reusing from Rack's showexception class.

Please sign in to comment.