Class: WhoNeedsWP::Sidebar
- Inherits:
-
Object
- Object
- WhoNeedsWP::Sidebar
- Defined in:
- lib/who-needs-wp/Sidebar.rb
Overview
Abstract class to be implemented by all sidebar elements
Direct Known Subclasses
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
-
.render_all ⇒ Object
Iterate through all of the side bar instances, render them and return as HTML.
Instance Method Summary collapse
-
#initialize ⇒ Sidebar
constructor
Create a new instance of this sidebar.
-
#render ⇒ Object
Render this peice of sidebar content.
Constructor Details
#initialize ⇒ Sidebar
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_all ⇒ Object
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
#render ⇒ Object
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 |