Class: HamlCoffeeAssets::HamlCoffeeTemplate
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- HamlCoffeeAssets::HamlCoffeeTemplate
- Defined in:
- lib/haml_coffee_assets/haml_coffee_template.rb
Overview
Haml CoffeeScript template implementation for Tilt.
Class Attribute Summary collapse
-
.name_filter ⇒ Object
A proc that is called to modify the template name used as the JST key.
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 Attribute Details
.name_filter ⇒ Object
A proc that is called to modify the template name used as the JST key. The proc is passed the name as an argument and should return the modified name (or unmodified) name.
15 16 17 |
# File 'lib/haml_coffee_assets/haml_coffee_template.rb', line 15 def name_filter @name_filter end |
Class Method Details
.engine_initialized? ⇒ Boolean
Test if the compiler is initialized.
26 27 28 |
# File 'lib/haml_coffee_assets/haml_coffee_template.rb', line 26 def self.engine_initialized? defined? HamlCoffee end |
Instance Method Details
#evaluate(scope, locals = { }, &block) ⇒ Object
Compile the template.
43 44 45 46 47 48 |
# File 'lib/haml_coffee_assets/haml_coffee_template.rb', line 43 def evaluate(scope, locals = { }, &block) jst = scope.pathname.to_s =~ /\.jst\.hamlc(?:\.|$)/ ? false : true name = scope.logical_path name = self.class.name_filter.call(name) if self.class.name_filter && jst @output ||= HamlCoffee.compile(name, data, jst) end |
#initialize_engine ⇒ Object
Initialize the template engine.
32 33 34 |
# File 'lib/haml_coffee_assets/haml_coffee_template.rb', line 32 def initialize_engine require_template_library 'haml_coffee' end |
#prepare ⇒ Object
Prepare the template
38 39 |
# File 'lib/haml_coffee_assets/haml_coffee_template.rb', line 38 def prepare end |