Class: Dimples::Entries::Page
Overview
A single page on a site.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#contents, #metadata, #path, #rendered_contents
Instance Method Summary collapse
-
#initialize(site:, path:) ⇒ Page
constructor
A new instance of Page.
- #output_directory ⇒ Object
- #url ⇒ Object
Methods inherited from Base
#method_missing, #parse_metadata, #render, #respond_to_missing?, #template, #write
Constructor Details
#initialize(site:, path:) ⇒ Page
7 8 9 |
# File 'lib/dimples/entries/page.rb', line 7 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::Entries::Base
Instance Method Details
#output_directory ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dimples/entries/page.rb', line 11 def output_directory @output_directory ||= File.dirname(@path).gsub( @site.config.source_paths[:pages], @site.config.build_paths[:root] ).concat('/') end |
#url ⇒ Object
18 19 20 |
# File 'lib/dimples/entries/page.rb', line 18 def url output_directory.tap { |url| url.concat(filename) unless filename == 'index.html' } end |