Module: Zorglub::Engines::Haml

Defined in:
lib/zorglub/engines/haml.rb

Class Method Summary collapse

Class Method Details

.proc(path, obj) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/zorglub/engines/haml.rb', line 9

def self.proc path,obj
    if obj.app.opt(:engines_cache_enabled)
        key = path.sub obj.app.opt(:root),''
        haml = obj.app.engines_cache[key] ||= ::Haml::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:haml_options) )
    else
        haml = ::Haml::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:haml_options) )
    end
    html = haml.render(obj)
    return html, 'text/html'
end