Class: Charming::Templates::ErbHandler

Inherits:
Object
  • Object
show all
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

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_cacheObject

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