Class: Lanes::API::LanesTemplates
Instance Method Summary
collapse
#prepare, register, #wrap_js
Instance Method Details
#combined_contents ⇒ Object
67
68
69
|
# File 'lib/lanes/api/javascript_processor.rb', line 67
def combined_contents
[CoffeeScript::Source.contents, contents].join(";\n")
end
|
#compile(template) ⇒ Object
75
76
77
78
|
# File 'lib/lanes/api/javascript_processor.rb', line 75
def compile(template)
template = template.read if template.respond_to?(:read)
context.call("eco.precompile", template, 'Lanes.Templates.Wrapper','Lanes.Views.Helpers')
end
|
#contents ⇒ Object
63
64
65
|
# File 'lib/lanes/api/javascript_processor.rb', line 63
def contents
@contents ||= Pathname.new(__FILE__).dirname.join('eco.js').read
end
|
#context ⇒ Object
71
72
73
|
# File 'lib/lanes/api/javascript_processor.rb', line 71
def context
@context ||= ExecJS.compile(combined_contents)
end
|
#evaluate(scope, locals, &block) ⇒ Object
59
60
61
|
# File 'lib/lanes/api/javascript_processor.rb', line 59
def evaluate(scope, locals, &block)
"Lanes.Templates['#{scope.logical_path}']=" + self.compile(data)
end
|