Class: HamlCoffeeAssets::ActionView::TemplateHandler
- Inherits:
-
Object
- Object
- HamlCoffeeAssets::ActionView::TemplateHandler
- Defined in:
- lib/haml_coffee_assets/action_view/template_handler.rb
Constant Summary collapse
- DEPENDENCY_PATTERN =
/(?:window\.)?JST(?:\[["']([\w\/]+)["']\]|\.(\w+))/
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(template, partial = false, dependencies = []) ⇒ TemplateHandler
constructor
A new instance of TemplateHandler.
- #render ⇒ Object
Constructor Details
#initialize(template, partial = false, dependencies = []) ⇒ TemplateHandler
Returns a new instance of TemplateHandler.
14 15 16 17 18 |
# File 'lib/haml_coffee_assets/action_view/template_handler.rb', line 14 def initialize(template, partial = false, dependencies = []) @template = template @partial = partial @dependencies = dependencies end |
Class Method Details
.call(template, _body = nil) ⇒ Object
6 7 8 |
# File 'lib/haml_coffee_assets/action_view/template_handler.rb', line 6 def self.call(template, _body = nil) new(template).render end |
.stale?(last_compile_time) ⇒ Boolean
10 11 12 |
# File 'lib/haml_coffee_assets/action_view/template_handler.rb', line 10 def self.stale?(last_compile_time) GlobalContext.mtime > last_compile_time end |
Instance Method Details
#render ⇒ Object
20 21 22 |
# File 'lib/haml_coffee_assets/action_view/template_handler.rb', line 20 def render "ExecJS.compile(#{ compilation_string }).eval(#{ evaluation_string }).html_safe" end |