Class: Linner::Wrapper::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/linner/wrapper.rb

Class Method Summary collapse

Class Method Details

.definition(content) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/linner/wrapper.rb', line 29

def self.definition(content)
<<-DEFINITION
(function() {
  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  #{content}
})();
DEFINITION
end

.partial_wrap(name, content) ⇒ Object



22
23
24
25
26
# File 'lib/linner/wrapper.rb', line 22

def self.partial_wrap(name, content)
<<-PARTIAL
Handlebars.registerPartial("#{name}", Handlebars.template(#{content}));
PARTIAL
end

.wrap(name, content) ⇒ Object



16
17
18
19
20
# File 'lib/linner/wrapper.rb', line 16

def self.wrap(name, content)
<<-WRAPPER
templates["#{name}"] = template(#{content});
WRAPPER
end