Class: HandlebarsAssets::HandlebarsTemplate

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/handlebars_assets/handlebars_template.rb

Overview

Sprockets <= 3

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



17
18
19
# File 'lib/handlebars_assets/handlebars_template.rb', line 17

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

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



29
30
31
32
# File 'lib/handlebars_assets/handlebars_template.rb', line 29

def evaluate(scope, locals, &block)
  source = @engine.render(scope, locals, &block)
  renderer.compile(source)
end

#initialize_engineObject



21
22
23
# File 'lib/handlebars_assets/handlebars_template.rb', line 21

def initialize_engine
  HandlebarsRenderer.initialize_engine
end

#prepareObject



25
26
27
# File 'lib/handlebars_assets/handlebars_template.rb', line 25

def prepare
  @engine = renderer.choose_engine(data)
end