lib/wunderbar/script.rb in wunderbar-0.24.1 vs lib/wunderbar/script.rb in wunderbar-0.24.2
- old
+ new
@@ -81,10 +81,10 @@
def self.mime; 'application/javascript'; end
def evaluate(scope, locals, &block)
scope.content_type self.class.default_mime_type, charset: 'utf-8'
begin
- Ruby2JS.convert(data, ivars: locals, file: file)
+ Ruby2JS.convert(block ? block : data, ivars: locals, file: file)
rescue Parser::SyntaxError => exception
scope.response.status = 500
location = exception.diagnostic.location
"Syntax Error: line #{location.line}, column: #{location.column}" +
"\n#{exception}\n"