Class: HandlebarsAssets::HandlebarsProcessor

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

Overview

Sprockets 4

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HandlebarsProcessor

Returns a new instance of HandlebarsProcessor.



58
59
60
# File 'lib/handlebars_assets/handlebars_template.rb', line 58

def initialize(options = {})
  @cache_key = [self.class.name, ::HandlebarsAssets::VERSION, options].freeze
end

Instance Attribute Details

#cache_keyObject (readonly)

Returns the value of attribute cache_key.



56
57
58
# File 'lib/handlebars_assets/handlebars_template.rb', line 56

def cache_key
  @cache_key
end

Class Method Details

.cache_keyObject



52
53
54
# File 'lib/handlebars_assets/handlebars_template.rb', line 52

def self.cache_key
  instance.cache_key
end

.call(input) ⇒ Object



48
49
50
# File 'lib/handlebars_assets/handlebars_template.rb', line 48

def self.call(input)
  instance.call(input)
end

.instanceObject



44
45
46
# File 'lib/handlebars_assets/handlebars_template.rb', line 44

def self.instance
  @instance ||= new
end

Instance Method Details

#call(input) ⇒ Object



62
63
64
65
66
# File 'lib/handlebars_assets/handlebars_template.rb', line 62

def call(input)
  renderer = HandlebarsRenderer.new(path: input[:filename])
  engine = renderer.choose_engine(input[:data])
  renderer.compile(engine.render)
end