Class: Dimples::Page

Inherits:
Entry
  • Object
show all
Defined in:
lib/dimples/page.rb

Overview

A single page on a site.

Constant Summary

Constants inherited from Entry

Entry::FRONT_MATTER_PATTERN

Instance Attribute Summary

Attributes inherited from Entry

#contents, #metadata, #path, #rendered_contents

Instance Method Summary collapse

Methods inherited from Entry

#generate, #method_missing, #parse_metadata, #render, #respond_to_missing?, #template, #to_h, #url, #write

Constructor Details

#initialize(site:, path:) ⇒ Page

Returns a new instance of Page.



6
7
8
# File 'lib/dimples/page.rb', line 6

def initialize(site:, path:)
  super(site: site, source: Pathname.new(path))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dimples::Entry

Instance Method Details

#output_directoryObject



10
11
12
13
14
15
# File 'lib/dimples/page.rb', line 10

def output_directory
  @output_directory ||= File.dirname(@path).gsub(
    @site.config.source_paths[:pages],
    @site.config.build_paths[:root]
  ).concat('/')
end