Class: HandlebarsAssets::HandlebarsProcessor
- Inherits:
-
Object
- Object
- HandlebarsAssets::HandlebarsProcessor
- Defined in:
- lib/handlebars_assets/handlebars_template.rb
Overview
Sprockets 4
Instance Attribute Summary collapse
-
#cache_key ⇒ Object
readonly
Returns the value of attribute cache_key.
Class Method Summary collapse
Instance Method Summary collapse
- #call(input) ⇒ Object
-
#initialize(options = {}) ⇒ HandlebarsProcessor
constructor
A new instance of HandlebarsProcessor.
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( = {}) @cache_key = [self.class.name, ::HandlebarsAssets::VERSION, ].freeze end |
Instance Attribute Details
#cache_key ⇒ Object (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_key ⇒ Object
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 |
.instance ⇒ Object
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 |