Class: WhoNeedsWP::Page

Inherits:
Content show all
Defined in:
lib/who-needs-wp/content/Page.rb

Constant Summary collapse

@@pages =

A list of all the pages on the site

[]

Instance Attribute Summary

Attributes inherited from Content

#author, #filename, #html, #id, #markdown, #summary, #tags, #tiny_url, #title, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Content

#initialize

Constructor Details

This class inherits a constructor from WhoNeedsWP::Content

Class Method Details

.allObject

Return all the pages created



30
31
32
# File 'lib/who-needs-wp/content/Page.rb', line 30

def self.all
  return @@pages
end

.loadObject

Load all pages



6
7
8
9
10
11
# File 'lib/who-needs-wp/content/Page.rb', line 6

def self.load
  Dir.glob('pages/*.markdown').each do |filename|
    @@pages << Page.new(filename)
  end
  @@pages.sort! { |a, b| a.title <=> b.title }
end

.render_allObject

Render all the pages loaded



23
24
25
26
27
# File 'lib/who-needs-wp/content/Page.rb', line 23

def self.render_all
  @@pages.each do |page|
    page.render
  end
end

Instance Method Details

#renderObject

See Content.render_content



14
15
16
17
18
19
20
# File 'lib/who-needs-wp/content/Page.rb', line 14

def render
  @html = WhoNeedsWP::render_template("page", {
    :page => self,
    :title => @title
  })
  super()
end