Class: Charming::Templates::ErbHandler
- Inherits:
-
Object
- Object
- Charming::Templates::ErbHandler
- Defined in:
- lib/charming/presentation/templates/erb_handler.rb
Overview
ErbHandler renders ‘.tui.erb` / `.txt.erb` templates. Compiled ERB objects are cached per path: in development the cache is invalidated by file mtime so edits show up live; in other environments templates are compiled once.
Class Method Summary collapse
- .render(path, view) ⇒ Object
-
.reset_cache ⇒ Object
Clears the compiled-template cache (used by tests).
Class Method Details
.render(path, view) ⇒ Object
15 16 17 |
# File 'lib/charming/presentation/templates/erb_handler.rb', line 15 def render(path, view) erb(path).result(view.template_binding) end |
.reset_cache ⇒ Object
Clears the compiled-template cache (used by tests).
20 21 22 |
# File 'lib/charming/presentation/templates/erb_handler.rb', line 20 def reset_cache @mutex.synchronize { @cache.clear } end |