Class: JekyllSupport::Section
- Inherits:
-
Object
- Object
- JekyllSupport::Section
- Defined in:
- lib/structure/section.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#order ⇒ Object
Returns the value of attribute order.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_child(child) ⇒ Object
-
#initialize(outline_options, parameter_array) ⇒ Section
constructor
A new instance of Section.
- #to_s ⇒ Object
Constructor Details
#initialize(outline_options, parameter_array) ⇒ Section
Returns a new instance of Section.
7 8 9 10 11 12 |
# File 'lib/structure/section.rb', line 7 def initialize(, parameter_array) = @order = parameter_array[0].to_i @title = parameter_array[1] @children = [] end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
5 6 7 |
# File 'lib/structure/section.rb', line 5 def children @children end |
#order ⇒ Object
Returns the value of attribute order.
5 6 7 |
# File 'lib/structure/section.rb', line 5 def order @order end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/structure/section.rb', line 5 def title @title end |
Instance Method Details
#add_child(child) ⇒ Object
14 15 16 |
# File 'lib/structure/section.rb', line 14 def add_child(child) @children << child end |
#to_s ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/structure/section.rb', line 18 def to_s return '' if @children.count.zero? unless @children.first.instance_of?(JekyllSupport::APage) raise "First child of Section was a #{@children.first.class}, not an APage" end apages = @children .map { |x| x.render_outline_apage .pattern } .join("\n ") " <h3 class='post_title clear' id=\"title_\#{@order}\">\#{@title}</h3>\n <div id='posts_wrapper_\#{@order}' class='clearfix'>\n <div id=\"posts_\#{@order}\" class='posts'>\n \#{apages}\n </div>\n </div>\n END_SECTION\nend\n" |