Class: Infoboxer::Navigation::Sections::Section
- Inherits:
- 
      Tree::Compound
      
        - Object
- Tree::Node
- Tree::Compound
- Infoboxer::Navigation::Sections::Section
 
- Includes:
- Container
- Defined in:
- lib/infoboxer/navigation/sections.rb
Overview
Virtual node, representing logical section of the document. Is not, in fact, in the tree.
See parent module documentation for details.
Instance Attribute Summary collapse
- 
  
    
      #heading  ⇒ Tree::Heading 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Section's heading. 
Attributes inherited from Tree::Compound
Attributes inherited from Tree::Node
Instance Method Summary collapse
- #empty? ⇒ Boolean
- 
  
    
      #initialize(heading, children = )  ⇒ Section 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Section. 
- #inspect ⇒ Object
- 
  
    
      #push_children(*nodes)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    no rewriting of parent, again. 
Methods included from Container
#intro, #lookup_children, #sections, #subsections
Methods inherited from Tree::Compound
Methods inherited from Tree::Node
#==, #children, coder, def_readers, #first?, #index, #next_siblings, #prev_siblings, #siblings, #text, #text_, #to_s, #to_tree
Methods included from Wikipath
Methods included from Node
Methods included from Infoboxer::Navigation::Shortcuts::Node
#bold?, #categories, #external_links, #heading?, #headings, #images, #infobox, #infoboxes, #italic?, #lists, #paragraphs, #tables, #templates, #wikilinks
Methods included from Lookup::Node
#_lookup, #_lookup_children, #_lookup_next_siblings, #_lookup_parents, #_lookup_prev_sibling, #_lookup_prev_siblings, #_lookup_siblings, #_matches?, #lookup, #lookup_children, #lookup_next_siblings, #lookup_parents, #lookup_prev_sibling, #lookup_prev_siblings, #lookup_siblings, #matches?, #parent?
Constructor Details
#initialize(heading, children = ) ⇒ Section
Returns a new instance of Section.
| 189 190 191 192 193 194 | # File 'lib/infoboxer/navigation/sections.rb', line 189 def initialize(heading, children = Tree::Nodes[]) # no super: we don't wont to rewrite children's parent @children = Tree::Nodes[*children] @heading = heading @params = {level: heading.level, heading: heading.text.strip} end | 
Instance Attribute Details
#heading ⇒ Tree::Heading (readonly)
Section's heading.
| 199 200 201 | # File 'lib/infoboxer/navigation/sections.rb', line 199 def heading @heading end | 
Instance Method Details
#empty? ⇒ Boolean
| 208 209 210 | # File 'lib/infoboxer/navigation/sections.rb', line 208 def empty? false end | 
#inspect ⇒ Object
| 212 213 214 | # File 'lib/infoboxer/navigation/sections.rb', line 212 def inspect "#<#{descr}: #{children.count} nodes>" end | 
#push_children(*nodes) ⇒ Object
no rewriting of parent, again
| 202 203 204 205 206 | # File 'lib/infoboxer/navigation/sections.rb', line 202 def push_children(*nodes) nodes.each do |n| @children << n end end |