Class: Handlebarer::Template
- Defined in:
- lib/handlebarer/template.rb
Overview
Handlebarer Tilt template for use with JST
Class Method Summary collapse
-
.engine_initialized? ⇒ Boolean
Ensure V8 is available when engine is initialized.
Instance Method Summary collapse
-
#evaluate(scope, locals, &block) ⇒ String
Evaluate the template.
-
#initialize_engine ⇒ Object
Require ‘execjs’ when initializing engine.
- #prepare ⇒ Object
Class Method Details
.engine_initialized? ⇒ Boolean
Ensure V8 is available when engine is initialized
10 11 12 |
# File 'lib/handlebarer/template.rb', line 10 def self.engine_initialized? defined? ::V8 end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ String
Evaluate the template. Compiles the template for JST
24 25 26 27 |
# File 'lib/handlebarer/template.rb', line 24 def evaluate(scope, locals, &block) c = Handlebarer::Compiler.new c.compile(data) end |
#initialize_engine ⇒ Object
Require ‘execjs’ when initializing engine
15 16 17 |
# File 'lib/handlebarer/template.rb', line 15 def initialize_engine require_template_library 'v8' end |
#prepare ⇒ Object
19 20 |
# File 'lib/handlebarer/template.rb', line 19 def prepare end |