class Sitepress::BuildPaths::RootPath

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`.

Attributes

resource[R]

Public Class Methods

new(resource) click to toggle source
# File lib/sitepress/build_paths/root_path.rb, line 12
def initialize(resource)
  @resource = resource
end

Public Instance Methods

filename() click to toggle source
# 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
path() click to toggle source
# File lib/sitepress/build_paths/root_path.rb, line 26
def path
  File.join(*resource.lineage, filename)
end

Protected Instance Methods

filename_with_default_format() click to toggle source
# File lib/sitepress/build_paths/root_path.rb, line 39
def filename_with_default_format
  filename_with_format
end
filename_with_format() click to toggle source
# File lib/sitepress/build_paths/root_path.rb, line 35
def filename_with_format
  "#{node.default_name}.#{format}"
end
filename_without_format() click to toggle source
# File lib/sitepress/build_paths/root_path.rb, line 31
def filename_without_format
  node.default_name
end