Class: WhoNeedsWP::Sidebar

Inherits:
Object
  • Object
show all
Defined in:
lib/who-needs-wp/Sidebar.rb

Overview

Abstract class to be implemented by all sidebar elements

Direct Known Subclasses

Delicious, Latitude, PageIndex, RecentPosts, TwitterSidebar

Constant Summary collapse

@@content =

A list of Sidebar instances which will be rendered

[]
@@generated =

The HTML output of all of the sidebar instances combined

nil

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSidebar

Create a new instance of this sidebar



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

def initialize
  @logger = Logger.new(STDOUT)
  @@content << self
end

Class Method Details

.render_allObject

Iterate through all of the side bar instances, render them and return as HTML



11
12
13
14
15
16
17
18
19
20
# File 'lib/who-needs-wp/Sidebar.rb', line 11

def self.render_all
  if @@generated == nil
    retval = []
    @@content.each do |content|
      retval << content.render
    end
    @@generated = retval.join
  end
  return @@generated
end

Instance Method Details

#renderObject

Render this peice of sidebar content. Returns HTML.



29
30
31
# File 'lib/who-needs-wp/Sidebar.rb', line 29

def render
  # To be implemented.
end