Class: Peregrin::Outliner::Section
- Inherits:
-
Object
- Object
- Peregrin::Outliner::Section
- Defined in:
- lib/peregrin/outliner.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
Returns the value of attribute container.
-
#heading ⇒ Object
Returns the value of attribute heading.
-
#node ⇒ Object
Returns the value of attribute node.
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
- #append(subsection) ⇒ Object
- #empty? ⇒ Boolean
- #heading_rank ⇒ Object
- #heading_text ⇒ Object
-
#initialize(node = nil) ⇒ Section
constructor
A new instance of Section.
Constructor Details
#initialize(node = nil) ⇒ Section
Returns a new instance of Section.
57 58 59 60 |
# File 'lib/peregrin/outliner.rb', line 57 def initialize(node = nil) self.node = node self.sections = [] end |
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container.
54 55 56 |
# File 'lib/peregrin/outliner.rb', line 54 def container @container end |
#heading ⇒ Object
Returns the value of attribute heading.
54 55 56 |
# File 'lib/peregrin/outliner.rb', line 54 def heading @heading end |
#node ⇒ Object
Returns the value of attribute node.
54 55 56 |
# File 'lib/peregrin/outliner.rb', line 54 def node @node end |
#sections ⇒ Object
Returns the value of attribute sections.
54 55 56 |
# File 'lib/peregrin/outliner.rb', line 54 def sections @sections end |
Instance Method Details
#append(subsection) ⇒ Object
63 64 65 66 |
# File 'lib/peregrin/outliner.rb', line 63 def append(subsection) subsection.container = self sections.push(subsection) end |
#empty? ⇒ Boolean
69 70 71 |
# File 'lib/peregrin/outliner.rb', line 69 def empty? heading_text.nil? && sections.all? { |sxn| sxn.empty? } end |
#heading_rank ⇒ Object
83 84 85 86 |
# File 'lib/peregrin/outliner.rb', line 83 def heading_rank # FIXME: some doubt as to whether 1 is the sensible default Utils.heading?(heading) ? Utils.heading_rank(heading) : 1 end |