class Zine::DataPage
A page where the content comes from an array, usually an array of links to other pages, eg an index page like the home page
Public Class Methods
new(data, templates, site_options, suffix = '.html')
click to toggle source
# File lib/zine/data_page.rb, line 7 def initialize(data, templates, site_options, suffix = '.html') init_templates(templates) @formatted_data = FormattedData.new({}, site_options) @formatted_data.page[:title] = data[:title] @formatted_data.data = data[:post_array] @dest_path = File.join(data[:build_dir], Zine::Page.slug(data[:name]) + suffix) write end
Public Instance Methods
write()
click to toggle source
# File lib/zine/data_page.rb, line 17 def write html = template_the_html compressor = HtmlCompressor::Compressor.new File.write(@dest_path, compressor.compress(html)) end