class Wunderbar::Template::Base
Public Class Methods
engine_initialized?()
click to toggle source
# File lib/wunderbar/sinatra.rb, line 45 def self.engine_initialized? defined? ::Wunderbar end
evaluate(template, scope, *args, &block)
click to toggle source
# File lib/wunderbar/sinatra.rb, line 68 def self.evaluate(template, scope, *args, &block) scope.content_type default_mime_type if block output = new(&Proc.new {}).evaluate(scope, {}, &block) else output = scope.send :render, template, *args end scope.etag Digest::MD5.hexdigest(output) output end
Public Instance Methods
initialize_engine()
click to toggle source
# File lib/wunderbar/sinatra.rb, line 49 def initialize_engine require_template_library 'wunderbar' end
precompiled_postamble(locals)
click to toggle source
# File lib/wunderbar/sinatra.rb, line 64 def precompiled_postamble(locals) raise NotImplementedError.new("dynamic only") end
precompiled_preamble(locals)
click to toggle source
# File lib/wunderbar/sinatra.rb, line 60 def precompiled_preamble(locals) raise NotImplementedError.new("dynamic only") end
precompiled_template(locals)
click to toggle source
# File lib/wunderbar/sinatra.rb, line 56 def precompiled_template(locals) raise NotImplementedError.new("dynamic only") end
prepare()
click to toggle source
# File lib/wunderbar/sinatra.rb, line 53 def prepare end
Private Instance Methods
_evaluate(builder, scope, locals, &block)
click to toggle source
# File lib/wunderbar/sinatra.rb, line 81 def _evaluate(builder, scope, locals, &block) builder.set_variables_from_params(locals) if not block builder.instance_eval(data, eval_file) elsif not data builder.instance_eval(&block) else context = builder.get_binding do builder.instance_eval {_(&block)} end context.eval(data, eval_file) end end