Class: Yuzu::Core::HamlTemplate

Inherits:
Template show all
Defined in:
lib/yuzu/core/template.rb

Direct Known Subclasses

Layout

Instance Method Summary collapse

Methods inherited from Template

#contents, #exists?, #fallback_exists?, #fallback_path, #get_contents, #get_template_contents, #initialize, #path

Constructor Details

This class inherits a constructor from Yuzu::Core::Template

Instance Method Details

#engineObject



69
70
71
# File 'lib/yuzu/core/template.rb', line 69

def engine
  @engine ||= Haml::Engine.new(contents, options)
end

#locals(website_file) ⇒ Object



73
74
75
76
77
78
# File 'lib/yuzu/core/template.rb', line 73

def locals(website_file)
  {
    :post => website_file.properties,
    :config => website_file.config
  }
end

#optionsObject



65
66
67
# File 'lib/yuzu/core/template.rb', line 65

def options
  {:format => :html5}
end

#render(website_file, data = {}) ⇒ Object



80
81
82
83
84
85
# File 'lib/yuzu/core/template.rb', line 80

def render(website_file, data={})
  engine.render(
    TemplateMethods.new(website_file.root),
    locals(website_file).merge(data)
  )
end