class Clayoven::Toplevel::ContentPage

A “content page”

For .clay files nested within subdirectories, with a corresponding #{subdirectory}.index.clay in the ancestor directory.

Attributes

subtopic[RW]

The specific “subtopic” under which this ContentPage sits

topic[RW]

The specific “topic” under which this ContentPage sits

Public Class Methods

new(filename, git) click to toggle source

Initialize Page#topic, Page#subtopic, Page#permalink, and Page#target

Calls superclass method Clayoven::Toplevel::Page::new
# File lib/clayoven/toplevel.rb, line 125
def initialize(filename, git)
  super
  # There cannot be ContentPages nested under 'index'
  @topic, @subtopic, = @filename.split "/", 3
  @subtopic = nil if @subtopic.end_with?(".clay")
  @permalink = @filename.split(".clay").first
  @target = "#{@permalink}.html"
end

Public Instance Methods

<=>(other) click to toggle source

sort is unstable, and we resolve equality of crdate elegantly

# File lib/clayoven/toplevel.rb, line 135
def <=>(other)
  if crdate.to_i == other.crdate.to_i
    other.permalink <=> permalink
  else
    other.crdate.to_i <=> crdate.to_i
  end
end