Class: Coradoc::Element::Section
- Inherits:
-
Object
- Object
- Coradoc::Element::Section
- Defined in:
- lib/coradoc/element/section.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #content ⇒ Object
- #glossaries ⇒ Object
-
#initialize(title, options = {}) ⇒ Section
constructor
A new instance of Section.
- #to_adoc ⇒ Object
Constructor Details
#initialize(title, options = {}) ⇒ Section
Returns a new instance of Section.
6 7 8 9 10 11 12 |
# File 'lib/coradoc/element/section.rb', line 6 def initialize(title, = {}) @title = title @id = .fetch(:id, nil) @contents = .fetch(:contents, []) @sections = .fetch(:sections, []) @anchor = @id.nil? ? nil : Inline::Anchor.new(@id) end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
4 5 6 |
# File 'lib/coradoc/element/section.rb', line 4 def contents @contents end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/coradoc/element/section.rb', line 4 def id @id end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
4 5 6 |
# File 'lib/coradoc/element/section.rb', line 4 def sections @sections end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/coradoc/element/section.rb', line 4 def title @title end |
Instance Method Details
#content ⇒ Object
18 19 20 21 22 |
# File 'lib/coradoc/element/section.rb', line 18 def content if contents.count == 1 && contents.first.is_a?(Coradoc::Element::Paragraph) contents.first end end |
#glossaries ⇒ Object
14 15 16 |
# File 'lib/coradoc/element/section.rb', line 14 def glossaries @glossaries ||= extract_glossaries end |