Class: Zine::DataPage
Overview
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
Instance Attribute Summary
Attributes inherited from Page
#dest_path, #formatted_data, #source_file, #template_bundle
Instance Method Summary collapse
-
#initialize(data, templates, site_options, suffix = '.html') ⇒ DataPage
constructor
A new instance of DataPage.
- #write ⇒ Object
Methods inherited from Page
Constructor Details
#initialize(data, templates, site_options, suffix = '.html') ⇒ DataPage
Returns a new instance of DataPage.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/zine/data_page.rb', line 9 def initialize(data, templates, , suffix = '.html') # super(front_matter, site_opt) init_templates(templates) @formatted_data = FormattedData.new({}, ) @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 |
Instance Method Details
#write ⇒ Object
20 21 22 23 24 |
# File 'lib/zine/data_page.rb', line 20 def write html = template_the_html compressor = HtmlCompressor::Compressor.new File.write(@dest_path, compressor.compress(html)) end |