Class: Wunderbar::Template::Html

Inherits:
Base
  • Object
show all
Defined in:
lib/wunderbar/sinatra.rb

Direct Known Subclasses

Xhtml

Instance Method Summary collapse

Methods inherited from Base

engine_initialized?, evaluate, #initialize_engine, #precompiled_postamble, #precompiled_preamble, #precompiled_template, #prepare

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/wunderbar/sinatra.rb', line 72

def evaluate(scope, locals, &block)
  builder = HtmlMarkup.new(scope)
  begin
    _evaluate_safely(builder, scope, locals, &block)
  rescue Exception => exception
    scope.response.status = 500
    builder.clear!
    builder.html do
      _head do
        _title 'Internal Server Error'
      end
      _body do
        _h1 'Internal Server Error'
        _exception exception
      end
    end
  end
  builder._.target!.join
end