Class: BackboneHandlebars::Template

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/backbone_handlebars/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



12
13
14
# File 'lib/backbone_handlebars/template.rb', line 12

def self.default_mime_type
  'application/javascript'
end

.handlebarsObject



8
9
10
# File 'lib/backbone_handlebars/template.rb', line 8

def self.handlebars
  @@handlebars ||= File.new(::Rails.configuration.handlebars.path).read
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/backbone_handlebars/template.rb', line 18

def evaluate(scope, locals, &block)
  path = scope.logical_path.gsub(/^templates\//i, '')

  if ::Rails.configuration.handlebars.precompile == true
    template = precompile_handlebars(path, data)
  else
    template = compile_handlebars(path, data)
  end
end

#prepareObject



16
# File 'lib/backbone_handlebars/template.rb', line 16

def prepare; end