Class: Wunderbar::Template::Text

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

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



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/wunderbar/sinatra.rb', line 116

def evaluate(scope, locals, &block)
  builder = TextBuilder.new(scope)
  begin
    _evaluate_safely(builder, scope, locals, &block)
    scope.response.status = 404 if builder.target!.empty?
  rescue Exception => exception
    scope.headers['Content-Type'] = self.class.default_mime_type
    scope.response.status = 500
    builder._exception exception
  end
  builder.target!
end