class Musako::Renderers::Index
Attributes
posts[RW]
Public Class Methods
new(file, posts)
click to toggle source
Calls superclass method
Musako::Renderer::new
# File lib/musako/renderers/index.rb, line 8 def initialize(file, posts) super file @file_extname = ".html" @posts = posts end
Public Instance Methods
output_path()
click to toggle source
# File lib/musako/renderers/index.rb, line 32 def output_path File.join(Musako.destination_path, self.file_name) end
render()
click to toggle source
# File lib/musako/renderers/index.rb, line 15 def render contents = Slim::Template.new( File.join(Musako.views_path, "index.slim") ).render(self, {posts: @posts, config: Musako.configuration}) layout = Slim::Template.new( File.join(Musako.views_path, "layouts", "application.slim") ).render(self, { title: Musako.configuration[:title], page_title: Musako.configuration[:title] }) { contents } File.open(self.output_path, "w") do |file| file.write layout end end