Class: Wunderbar::Template::Base

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

Direct Known Subclasses

Html, Json, Text

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/wunderbar/sinatra.rb', line 9

def self.engine_initialized?
  defined? ::Wunderbar
end

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



32
33
34
35
36
37
38
39
40
41
# File 'lib/wunderbar/sinatra.rb', line 32

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



13
14
15
# File 'lib/wunderbar/sinatra.rb', line 13

def initialize_engine
  require_template_library 'wunderbar'
end

#precompiled_postamble(locals) ⇒ Object

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/wunderbar/sinatra.rb', line 28

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

#precompiled_preamble(locals) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/wunderbar/sinatra.rb', line 24

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

#precompiled_template(locals) ⇒ Object

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/wunderbar/sinatra.rb', line 20

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

#prepareObject



17
18
# File 'lib/wunderbar/sinatra.rb', line 17

def prepare
end