Class: Sitepress::BuildPaths::RootPath

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sitepress/build_paths/root_path.rb

Overview

Compiles pages directly from ‘/pages/blah.html.haml` to `/blah.html`. Handles root `index` pages too, mainly grabbing the root, which doesn’t have a name in the node, to the default_name of the node, which is usually ‘index`.

Direct Known Subclasses

IndexPath

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ RootPath

Returns a new instance of RootPath.



12
13
14
# File 'lib/sitepress/build_paths/root_path.rb', line 12

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'lib/sitepress/build_paths/root_path.rb', line 7

def resource
  @resource
end

Instance Method Details

#filenameObject



16
17
18
19
20
21
22
23
24
# File 'lib/sitepress/build_paths/root_path.rb', line 16

def filename
  if format.nil?
    filename_without_format
  elsif format == node.default_format
    filename_with_default_format
  elsif format
    filename_with_format
  end
end

#pathObject



26
27
28
# File 'lib/sitepress/build_paths/root_path.rb', line 26

def path
  File.join(*resource.lineage, filename)
end