Class: Fastr::Template::Haml

Inherits:
Object
  • Object
show all
Defined in:
lib/fastr/template/haml.rb

Defined Under Namespace

Modules: Mixin

Class Method Summary collapse

Class Method Details

.result(tpl_path, _binding) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/fastr/template/haml.rb', line 7

def self.result(tpl_path, _binding)
  engine = Fastr::Template::TEMPLATE_CACHE[tpl_path]
  unless engine and cache_template
    engine = ::Haml::Engine.new(File.read("app/views/#{tpl_path}"))
    Fastr::Template::TEMPLATE_CACHE[tpl_path] = engine
  end
  engine.render(_binding)
end