Class: HamlCoffeeAssets::Tilt::TemplateHandler
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- HamlCoffeeAssets::Tilt::TemplateHandler
- Defined in:
- lib/haml_coffee_assets/tilt/template_handler.rb
Overview
Haml Coffee template handler implementation for Tilt.
Class Method Summary collapse
-
.engine_initialized? ⇒ Boolean
Test if the compiler is initialized.
Instance Method Summary collapse
-
#evaluate(scope, locals = { }, &block) ⇒ Object
Compile the template.
-
#initialize_engine ⇒ Object
Initialize the template engine.
-
#prepare ⇒ Object
Prepare the template.
Class Method Details
.engine_initialized? ⇒ Boolean
Test if the compiler is initialized.
18 19 20 |
# File 'lib/haml_coffee_assets/tilt/template_handler.rb', line 18 def self.engine_initialized? defined? HamlCoffeeAssets::Compiler end |
Instance Method Details
#evaluate(scope, locals = { }, &block) ⇒ Object
Compile the template.
35 36 37 38 39 40 41 |
# File 'lib/haml_coffee_assets/tilt/template_handler.rb', line 35 def evaluate(scope, locals = { }, &block) jst = !!(scope.pathname.to_s =~ /\.jst\.hamlc(?:\.|$)/) name = scope.logical_path name = HamlCoffeeAssets.config.name_filter.call(name) if HamlCoffeeAssets.config.name_filter && !jst @output ||= HamlCoffeeAssets::Compiler.compile(name, data, !jst) end |
#initialize_engine ⇒ Object
Initialize the template engine.
24 25 26 |
# File 'lib/haml_coffee_assets/tilt/template_handler.rb', line 24 def initialize_engine require_template_library 'haml_coffee_assets/compiler' end |
#prepare ⇒ Object
Prepare the template
30 31 |
# File 'lib/haml_coffee_assets/tilt/template_handler.rb', line 30 def prepare end |