Class: Malt::Engine::Haml

Inherits:
Abstract show all
Defined in:
lib/malt/engines/haml.rb

Overview

Haml

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, default, #initialize, #prepare_engine, register, type

Constructor Details

This class inherits a constructor from Malt::Engine::Abstract

Instance Method Details

#create_engine(params = {}) ⇒ Object


26
27
28
29
30
31
# File 'lib/malt/engines/haml.rb', line 26

def create_engine(params={})
  text, file = parameters(params, :text, :file)
  cached(text, file) do
    ::Haml::Engine.new(text, :filename=>file)
  end
end

#render(params = {}, &content) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/malt/engines/haml.rb', line 12

def render(params={}, &content)
  into, scope, locals = parameters(params, :to, :scope, :locals)

  scope, locals = make_ready(scope, locals, &content)

  case into
  when :html, nil
    prepare_engine(params, &content).render(scope, locals, &content)
  else
    super(params, &content)
  end
end