Class: DocSection
- Inherits:
-
Object
- Object
- DocSection
- Defined in:
- lib/almirah/dom/doc_section.rb
Instance Attribute Summary collapse
-
#heading ⇒ Object
Returns the value of attribute heading.
-
#parent_section ⇒ Object
Returns the value of attribute parent_section.
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
-
#initialize(heading) ⇒ DocSection
constructor
A new instance of DocSection.
-
#to_html ⇒ Object
rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize(heading) ⇒ DocSection
Returns a new instance of DocSection.
4 5 6 7 8 |
# File 'lib/almirah/dom/doc_section.rb', line 4 def initialize(heading) @sections = [] @heading = heading @parent_section = nil end |
Instance Attribute Details
#heading ⇒ Object
Returns the value of attribute heading.
2 3 4 |
# File 'lib/almirah/dom/doc_section.rb', line 2 def heading @heading end |
#parent_section ⇒ Object
Returns the value of attribute parent_section.
2 3 4 |
# File 'lib/almirah/dom/doc_section.rb', line 2 def parent_section @parent_section end |
#sections ⇒ Object
Returns the value of attribute sections.
2 3 4 |
# File 'lib/almirah/dom/doc_section.rb', line 2 def sections @sections end |
Instance Method Details
#to_html ⇒ Object
rubocop:disable Metrics/MethodLength
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/almirah/dom/doc_section.rb', line 10 def to_html # rubocop:disable Metrics/MethodLength s = '' s += "\t<li onclick=\"nav_toggle_expand_list(this, event)\">" \ '<span class="fa-li"><i class="fa fa-minus-square-o"> </i></span>' s += "<a href=\"##{@heading.anchor_id}\">#{@heading.get_section_info}</a>\n" unless @sections.empty? s += "\t\t<ul class=\"fa-ul\">\n" @sections.each do |sub_section| s += sub_section.to_html end s += "\t\t</ul>\n" end s += "</li>\n" s end |