Module: CFT
- Defined in:
- lib/cft.rb,
lib/cft/template.rb
Defined Under Namespace
Modules: Source
Classes: Template
Class Method Summary
collapse
Class Method Details
.compile(template) ⇒ Object
40
41
42
43
|
# File 'lib/cft.rb', line 40
def compile(template)
template = template.read if template.respond_to?(:read)
Source.context.call("cft.precompile", template)
end
|
.context_for(template) ⇒ Object
45
46
47
|
# File 'lib/cft.rb', line 45
def context_for(template)
ExecJS.compile("var render = #{compile(template)}")
end
|
.render(template, locals = {}) ⇒ Object
49
50
51
|
# File 'lib/cft.rb', line 49
def render(template, locals = {})
context_for(template).call("render", locals)
end
|
.version ⇒ Object
36
37
38
|
# File 'lib/cft.rb', line 36
def version
Source.version
end
|