Class: Ember::Handlebars::Template

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



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

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ember/handlebars/template.rb', line 14

def evaluate(scope, locals, &block)
  target = template_target(scope)
  raw = handlebars?(scope)

  if raw
    template = data
  else
    template = mustache_to_handlebars(scope, data)
  end

  if configuration.precompile
    if raw
      template = precompile_handlebars(template)
    else
      template = precompile_ember_handlebars(template)
    end
  else
    if raw
      template = compile_handlebars(data)
    else
      template = compile_ember_handlebars(template)
    end
  end

  "#{target} = #{template}\n"
end

#prepareObject



12
# File 'lib/ember/handlebars/template.rb', line 12

def prepare; end