Class: Wunderbar::Template::Base

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

Direct Known Subclasses

Html

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/wunderbar/sinatra.rb', line 45

def self.engine_initialized?
  defined? ::Wunderbar
end

.evaluate(template, scope, *args, &block) ⇒ Object



68
69
70
71
72
73
74
75
76
77
# 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

Instance Method Details

#initialize_engineObject



49
50
51
# File 'lib/wunderbar/sinatra.rb', line 49

def initialize_engine
  require_template_library 'wunderbar'
end

#precompiled_postamble(locals) ⇒ Object

Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/wunderbar/sinatra.rb', line 64

def precompiled_postamble(locals)
  raise NotImplementedError.new("dynamic only")
end

#precompiled_preamble(locals) ⇒ Object

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/wunderbar/sinatra.rb', line 60

def precompiled_preamble(locals)
  raise NotImplementedError.new("dynamic only")
end

#precompiled_template(locals) ⇒ Object

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/wunderbar/sinatra.rb', line 56

def precompiled_template(locals)
  raise NotImplementedError.new("dynamic only")
end

#prepareObject



53
54
# File 'lib/wunderbar/sinatra.rb', line 53

def prepare
end